Home

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

%3CLINGO-SUB%20id%3D%22lingo-sub-649277%22%20slang%3D%22en-US%22%3EExported%20Data%20creating%20two%20lines%20in%20a%20description.%20How%20can%20I%20move%20alternative%20rows%20to%20a%20New%20Column%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-649277%22%20slang%3D%22en-US%22%3E%3CP%3EI%20have%20a%20software%20data%20bank%20that%20when%20I%20export%20it%20into%20Excel%20it%20places%20the%202nd%20descriptor%20of%20the%20item%20into%20a%20row%20below%20the%20First.%26nbsp%3B%20How%20can%20I%20move%20each%20alternative%20row%20to%20a%20new%20column%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CTABLE%3E%3CTBODY%3E%3CTR%3E%3CTD%3EBOLTM16*150GAL%3C%2FTD%3E%3CTD%3EBolt%20M16%20x150mm%20Gal%20bolt%20%26amp%3B%20Nut%3C%2FTD%3E%3C%2FTR%3E%3CTR%3E%3CTD%3E%26nbsp%3B%3C%2FTD%3E%3CTD%3E%26amp%3B%20Washer%20-%20Structural%20GR8.8%3C%2FTD%3E%3C%2FTR%3E%3C%2FTBODY%3E%3C%2FTABLE%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-649277%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EExcel%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-649308%22%20slang%3D%22en-US%22%3ERe%3A%20Exported%20Data%20creating%20two%20lines%20in%20a%20description.%20How%20can%20I%20move%20alternative%20rows%20to%20a%20New%20Col%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-649308%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F349277%22%20target%3D%22_blank%22%3E%40Steve_Despatch%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3EHi%20Steve%2Cwith%20the%20following%20macro%20you%20transfer%20data%20from%20sheet1%20to%20sheet2.%20See%20attached%20file.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CPRE%3ESub%20Transfer()%3CBR%20%2F%3EDim%20lngRow%20As%20Long%3CBR%20%2F%3EDim%20lngRowmax%20As%20Long%3CBR%20%2F%3EDim%20lngz%20As%20Long%3CBR%20%2F%3E%3CBR%20%2F%3ESheet2.UsedRange.Clear%3CBR%20%2F%3ESheet1.Rows(1).Copy%20Destination%3A%3DSheet2.Range(%22A1%22)%3CBR%20%2F%3Elngz%20%3D%202%3CBR%20%2F%3EWith%20Sheet1%3CBR%20%2F%3ElngRowmax%20%3D%20.Cells(.Rows.Count%2C%201).End(xlUp).Row%3CBR%20%2F%3EFor%20lngRow%20%3D%202%20To%20lngRowmax%20Step%202%3CBR%20%2F%3E%3CBR%20%2F%3ESheet2.Rows(lngz).Value%20%3D%20.Rows(lngRow).Value%3CBR%20%2F%3ESheet2.Cells(lngz%2C%203).Value%20%3D%20.Cells(lngRow%20%2B%201%2C%202).Value%3CBR%20%2F%3Elngz%20%3D%20lngz%20%2B%201%3CBR%20%2F%3E%3CBR%20%2F%3ENext%20lngRow%3CBR%20%2F%3E%3CBR%20%2F%3EEnd%20With%3CBR%20%2F%3E%3CBR%20%2F%3EEnd%20Sub%3C%2FPRE%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ERegards%20from%20germany%3C%2FP%3E%3CP%3EBernd%3C%2FP%3E%3CP%3E%3CA%20href%3D%22http%3A%2F%2Fwww.vba-tanker.com%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ewww.vba-tanker.com%3C%2FA%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E
Steve_Despatch
Occasional Visitor

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

Related Conversations
How to Prevent Teams from Auto-Launch
chenrylee in Microsoft Teams on
28 Replies
Early preview of Microsoft Edge group policies
Sean Lyndersay in Discussions on
65 Replies
*Updated 9/3* Syncing in Microsoft Edge Preview Channels
Elliot Kirk in Articles on
201 Replies
Tabs and Dark Mode
cjc2112 in Discussions on
2 Replies