This macro worked ok for me with the data starting in row 1.
Option Explicit
Sub testme()
Dim wks As Worksheet
Dim FirstRow As Long
Dim LastRow As Long
Dim TopRow As Long
Dim iRow As Long
Dim oCol As Long
Set wks = Worksheets("sheet1")
With wks
TopRow = 1 'toprow of grouping
FirstRow = TopRow + 1 'leave row 1 alone!
LastRow = .Cells(.Rows.Count, "A").End(xlUp).Row
oCol = 2
For iRow = FirstRow To LastRow
If .Cells(TopRow, "A").Value = .Cells(iRow, "A").Value Then
oCol = oCol + 1
.Cells(TopRow, oCol).Value = .Cells(iRow, "B").Value
.Cells(iRow, "B").ClearContents
Else
TopRow = iRow
oCol = 2
End If
Next iRow
On Error Resume Next
.Columns(2).Cells.SpecialCells(xlCellTypeBlanks).E ntireRow.Delete
On Error GoTo 0
End With
End Sub
If you're new to macros, you may want to read David McRitchie's intro at:
http://www.mvps.org/dmcritchie/excel/getstarted.htm
bmac184 wrote:
I have a list that I need to transpose and can't figure out how to
accomplish it. Spreadsheet looks like this:
Column A Column B
AA Apple
AA Pear
BB Orange
BB Pineapple
BB Strawberry
CC Orange
and I want to transpose it to be:
Column A Column B Column C Column D
AA Apple Pear
BB Orange Pineapple Strawberry
CC Orange
Can anyone help??
--
bmac184
--
Dave Peterson