I have a table that can contain any number of rows:
As I said it can c
Try this code:
Dim lastrow As Long lastrow = Cells(Rows.Count, 2).End(xlUp).Row Range("A3:D" & lastrow).Sort key1:=Range("B3:B" & lastrow), _ order1:=xlAscending, Header:=xlNo