Thom
06-03-2008, 01:51 AM
Hi
I use a query with a sort to populate a number of sheets. this is works fine.
The data held is addresses and whatnot so each sheet is a city.
I need a sheet with every address on it which I have but I need to sort it.
So I need to sort column A, starting at cell A4. I need to find the last cell used in column A and do a sort.
I have this:
Dim LastRow As Long
With XLSheet
LastRow = .Range("A4").SpecialCells(xlCellTypeLastCell).Column
End With
Selection.Sort Key1:=Range("A4:LastRow"), Order1:=xlAscending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
But it doesn't like it.
I use a query with a sort to populate a number of sheets. this is works fine.
The data held is addresses and whatnot so each sheet is a city.
I need a sheet with every address on it which I have but I need to sort it.
So I need to sort column A, starting at cell A4. I need to find the last cell used in column A and do a sort.
I have this:
Dim LastRow As Long
With XLSheet
LastRow = .Range("A4").SpecialCells(xlCellTypeLastCell).Column
End With
Selection.Sort Key1:=Range("A4:LastRow"), Order1:=xlAscending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
But it doesn't like it.