I have multiple columns in a spreadsheet with headers that I will be adding to each over time but at different amounts. The columns will be independent from one another and growing at different rates.
I know how to sort all by currentregion, but that seemed to only allow sorting based off one header. For simplicity’s sake, how would you alphabetically sort 2 columns simultaneously next to each other?
Tried something like this but it won’t run:
Sub Alphabatize()
' Alphabatize Macro
Dim LastRowA As Long
Dim LastRowB As Long
'Determine Last Row
LastRowA = Range("A1" & Rows.Count).End(xlUp).Row
LastRowB = Range("B1" & Rows.Count).End(xlUp).Row
'Sort
With Range("A1")
.SetRange Range("A1:LastRowA")
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
With Range("B1")
.SetRange Range("B1:LastRowB")
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
End Sub