Change range from cells to sheet?

J

JBW

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
 
G

Gary''s Student

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top