DaveLansley
New Member
- Joined
- Apr 2, 2019
- Messages
- 4
Hi
When running the below code, I want to sort first by column B and then by column A, with results appearing at the top of the worksheet (underneath the header). Instead, there are lots of blank rows before the results actually appear. I know very little about VBA and was hoping someone could make the blank rows disappear!
Sub sort()
'Descending sort on A:H using columns B and A, all sheets in workbook
Dim WS As Worksheet
For Each WS In Worksheets
WS.Columns("A:H").Sort Key1:=WS.Columns("B"), Order1:=xlAscending, _
Key2:=WS.Columns(“A”), Order2:=xlAscending, Header:=x1No
Next WS
End Sub
When running the below code, I want to sort first by column B and then by column A, with results appearing at the top of the worksheet (underneath the header). Instead, there are lots of blank rows before the results actually appear. I know very little about VBA and was hoping someone could make the blank rows disappear!
Sub sort()
'Descending sort on A:H using columns B and A, all sheets in workbook
Dim WS As Worksheet
For Each WS In Worksheets
WS.Columns("A:H").Sort Key1:=WS.Columns("B"), Order1:=xlAscending, _
Key2:=WS.Columns(“A”), Order2:=xlAscending, Header:=x1No
Next WS
End Sub