Using a Variable in a SORT statement

Joined
Dec 8, 2009
Messages
2
Reaction score
0
I created a variable called "cnt". I want to use it in a SORT statement. I don't know if it can be done, I cannot make it work but I'm not sure if it is a syntax problem or just not possible.

I am using OFFICE 2003.

This is my statement:

Range("A1:E&CStr(cnt)").Sort Key1:=Range("A2"), Order1:=xlAscending, Header:=
xlGuess , OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
 
Last edited:
Joined
Dec 8, 2009
Messages
2
Reaction score
0
I discovered my problem. It was a misplaced QUOTE. The statement should read:Range("A1:E"&CStr(cnt)) then it all works fine.
 

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