This macro doesn't error, but why does it reach out ONLY to column O, even if columns contain data?
This one works below, but I have to hard code how many columns I want it to run on.
Code
Sub SortAllColumnsIndependently()
Dim x As Long, y As Long
On Error Resume Next
For x = 1 To 62
y = Cells(Rows.count, x).End(xlUp).Row 'count rows in each column
Range(Cells(1, x), Cells(y, x)).Sort Key1:=Cells(1, x), Order1:=xlAscending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, DataOption1:=xlSortNormal
Next x
End Sub
Display More