still learning
Well-known Member
- Joined
- Jan 15, 2010
- Messages
- 845
- Office Version
- 365
- Platform
- Windows
Hi
I’m trying to sort from data in A to L
The last row changes with new data
I have A3 frozen as I use it as a header
Data starts at A4
A:A has dates in it
I need the oldest date to start in A4 (A to Z)
As I add data, sometimes I can’t add in order
This works great but it doesn’t go to the last row that has data
I tried using the macro recorder but it also won’t go the last row. It only sorts up to when it was recorded.
As of today the last row is A39:L39, but I add data every few days
Mike
I’m trying to sort from data in A to L
The last row changes with new data
I have A3 frozen as I use it as a header
Data starts at A4
A:A has dates in it
I need the oldest date to start in A4 (A to Z)
As I add data, sometimes I can’t add in order
This works great but it doesn’t go to the last row that has data
I tried using the macro recorder but it also won’t go the last row. It only sorts up to when it was recorded.
As of today the last row is A39:L39, but I add data every few days
VBA Code:
Sub atoz()
.Range("A4", .Range("A" & Rows.Count).End(xlUp)).Resize(, 7).Sort _
Key1:=.Range("A11"), Order1:=xlAscending, Header:=xlNo, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
End Sub
Mike