Patriot2879
Well-known Member
- Joined
- Feb 1, 2018
- Messages
- 1,259
- Office Version
- 2010
- Platform
- Windows
Hi Please help, I have the code below where I have multiple sheets rows from A:Q and the source is B which is the date what I want from oldest to latest, B1 is the header so it should start from B2.
I am gettng an error on the 'Next'
I am gettng an error on the 'Next'
Code:
Private Sub CommandButton2_Click()
Dim wksht As Worksheet
For Each wksht In ThisWorkbook.Worksheets
wksht.Select
With Range("A2:Q" & Cells(Rows.Count, "A").End(xlUp).Row)
.Sort Key1:=Range("B2"), _
Order1:=xlAscending, _
Header:=xlNo, _
OrderCustom:=1, _
MatchCase:=False, _
Orientation:=xlTopToBottom, _
DataOption1:=xlSortTextAsNumbers
End With
Next
End Sub