sortingproblem

  • Thread starter Thread starter hans
  • Start date Start date
H

hans

I want a macro to sort a number of collums
I use the following program

Range(Cells(2, ccol), Cells(i - 1, ccol + 1)).Select

Selection.Sort Key1:=Range(Cells(1, ccol)), Order1:=xlAscending,
Header:=xlGuess, OrderCustom:=1, MatchCase:=False,
Orientation:=xlTopToBottom, DataOption1:=xlSortNormal

ccol is the column number and i is the deph
I get an error in the last line.

What am i doing wrong
 
Can't tell for sure. I don¹t see any continuation characters in your sort.
If it's on more than one line you need the _
To continue the code.

Make sure your range boundaries are getting a valid range. Ccol must be, but
I can't tell about i - 1 from here.

TH
 

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

Back
Top