Change range from cells to sheet?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Can I change the range from cells to sheet in following. I have problem when
data is bigger than range that macro currently selects, only sorts to 159th
line. ?

Range("A1:J159").Sort Key1:=Range("B3"), Order1:=xlAscending, Header:= _
xlGuess, OrderCustom:=1, MatchCase:=False,
Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
 
n = Cells(Rows.Count, "J").End(xlUp).Row
s = "A1:J" & n
Range(s).Sort.........

Just replace the address in the Range with the string
 
Back
Top