View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips[_6_] Bob Phillips[_6_] is offline
external usenet poster
 
Posts: 11,272
Default Reformat a worksheet using a macro

Hi Andrew,

Here is a little macro that does it

Sub Test()
Dim cLastRow As Long
Dim i As Long

cLastRow = Cells(Rows.Count, "A").End(xlUp).Row
For i = cLastRow To 3 Step -1
If Cells(i, "A").Value = Cells(i - 1, "A").Value Then
Cells(i, "B").Resize(1, 250).Copy _
Destination:=Cells(i - 1, "D")
Cells(i, "A").EntireRow.Delete
End If
Next i

End Sub



--

HTH

RP
(remove nothere from the email address if mailing direct)


"Andrew Hargreaves" wrote in message
om...
I would appreciate some help on this one, if anyone can help.

I have an exported CSV file that I need to format in a more legible
manner using Excel. The file lists some dates in one row after another
and I would like all of the dates to be in one row for each property.
At the moment it looks like this:

CustomerID Service NoAccess
21 19/05/2003 20/04/2004
21 19/05/2003 07/05/2004
21 19/05/2003 20/05/2004
21 19/05/2003 02/09/2004
27 10/03/2004 17/02/2005
27 10/03/2004 08/03/2005


What I would like to see is this.

Customer ID Service No Access
21 19/05/2003 20/04/2004 07/05/2004 20/05/2004
02/03/2004
27 10/03/2004 17/02/2005 08/03/2005

etc etc

Even if someone can give me a starter I can try and go with that, but
my VBA skills are rusty.

Cheers

Andrew H