Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I'm attempting to convert this list..
Column1 Colum2 Bob Apple Orange Bannana Tom Grape Strawberry Bill Coconut Mary Pineapple Watermellon etc.... Into this format.... Column1 Column2 Bob Apple, Orange, Bannana Tom Grape, Strawberry Bill Coconut Mary Pineapple, Watermellon Any help would be appreciated!! |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Do this against a copy of your workbook--or close without saving. It destroys
the original data: Option Explicit Sub testme02() Dim wks As Worksheet Dim LastRow As Long Dim FirstRow As Long Dim iRow As Long Set wks = Worksheets("Sheet1") With wks FirstRow = 2 'headers in row 1 LastRow = .Cells(.Rows.Count, "B").End(xlUp).Row For iRow = LastRow To FirstRow + 1 Step -1 If Trim(.Cells(iRow, "A").Value) = "" Then .Cells(iRow - 1, "B").Value = .Cells(iRow - 1, "B").Value _ & "," & .Cells(iRow, "B").Value .Rows(iRow).Delete End If Next iRow End With End Sub wrote: I'm attempting to convert this list.. Column1 Colum2 Bob Apple Orange Bannana Tom Grape Strawberry Bill Coconut Mary Pineapple Watermellon etc.... Into this format.... Column1 Column2 Bob Apple, Orange, Bannana Tom Grape, Strawberry Bill Coconut Mary Pineapple, Watermellon Any help would be appreciated!! -- Dave Peterson |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Try one of these two macros:
Sub ToRow2() With ActiveCell .Offset(1, 0).Resize(9, 1).Copy .Offset(0, 1).PasteSpecial Transpose:=True End With End Sub Sub ToRow() With ActiveCell .Resize(9, 1).Copy .Offset(0, 1).PasteSpecial Transpose:=True End With End Sub Regards, Ryan-- -- RyGuy "Dave Peterson" wrote: Do this against a copy of your workbook--or close without saving. It destroys the original data: Option Explicit Sub testme02() Dim wks As Worksheet Dim LastRow As Long Dim FirstRow As Long Dim iRow As Long Set wks = Worksheets("Sheet1") With wks FirstRow = 2 'headers in row 1 LastRow = .Cells(.Rows.Count, "B").End(xlUp).Row For iRow = LastRow To FirstRow + 1 Step -1 If Trim(.Cells(iRow, "A").Value) = "" Then .Cells(iRow - 1, "B").Value = .Cells(iRow - 1, "B").Value _ & "," & .Cells(iRow, "B").Value .Rows(iRow).Delete End If Next iRow End With End Sub wrote: I'm attempting to convert this list.. Column1 Colum2 Bob Apple Orange Bannana Tom Grape Strawberry Bill Coconut Mary Pineapple Watermellon etc.... Into this format.... Column1 Column2 Bob Apple, Orange, Bannana Tom Grape, Strawberry Bill Coconut Mary Pineapple, Watermellon Any help would be appreciated!! -- Dave Peterson |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
This won't work for the OP's original data.
That size of each group was variable. ryguy7272 wrote: Try one of these two macros: Sub ToRow2() With ActiveCell .Offset(1, 0).Resize(9, 1).Copy .Offset(0, 1).PasteSpecial Transpose:=True End With End Sub Sub ToRow() With ActiveCell .Resize(9, 1).Copy .Offset(0, 1).PasteSpecial Transpose:=True End With End Sub Regards, Ryan-- -- RyGuy "Dave Peterson" wrote: Do this against a copy of your workbook--or close without saving. It destroys the original data: Option Explicit Sub testme02() Dim wks As Worksheet Dim LastRow As Long Dim FirstRow As Long Dim iRow As Long Set wks = Worksheets("Sheet1") With wks FirstRow = 2 'headers in row 1 LastRow = .Cells(.Rows.Count, "B").End(xlUp).Row For iRow = LastRow To FirstRow + 1 Step -1 If Trim(.Cells(iRow, "A").Value) = "" Then .Cells(iRow - 1, "B").Value = .Cells(iRow - 1, "B").Value _ & "," & .Cells(iRow, "B").Value .Rows(iRow).Delete End If Next iRow End With End Sub wrote: I'm attempting to convert this list.. Column1 Colum2 Bob Apple Orange Bannana Tom Grape Strawberry Bill Coconut Mary Pineapple Watermellon etc.... Into this format.... Column1 Column2 Bob Apple, Orange, Bannana Tom Grape, Strawberry Bill Coconut Mary Pineapple, Watermellon Any help would be appreciated!! -- Dave Peterson -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Transpose random length series of cells | Excel Worksheet Functions | |||
Transpose a variable length list into Excel / Access Table | New Users to Excel | |||
Create Variable Length String Dependent Upon Size List | Excel Programming | |||
Filling combobox with variable length list | Excel Programming | |||
how to? running average from a variable length list | Excel Programming |