Exported Data creating two lines in a description. How can I move alternative rows to a New Column

Copper Contributor

I have a software data bank that when I export it into Excel it places the 2nd descriptor of the item into a row below the First.  How can I move each alternative row to a new column?

 

BOLTM16*150GALBolt M16 x150mm Gal bolt & Nut
 & Washer - Structural GR8.8
1 Reply

@Steve_Despatch 

Hi Steve,with the following macro you transfer data from sheet1 to sheet2. See attached file.

 

Sub Transfer()
Dim lngRow As Long
Dim lngRowmax As Long
Dim lngz As Long

Sheet2.UsedRange.Clear
Sheet1.Rows(1).Copy Destination:=Sheet2.Range("A1")
lngz = 2
With Sheet1
lngRowmax = .Cells(.Rows.Count, 1).End(xlUp).Row
For lngRow = 2 To lngRowmax Step 2

Sheet2.Rows(lngz).Value = .Rows(lngRow).Value
Sheet2.Cells(lngz, 3).Value = .Cells(lngRow + 1, 2).Value
lngz = lngz + 1

Next lngRow

End With

End Sub

 

Regards from germany

Bernd

www.vba-tanker.com