Problem coding a Sort

  • Thread starter Thread starter Peter Chatterton
  • Start date Start date
P

Peter Chatterton

How do I code this so as to use an Integer containing 7 for the column?
dataRange.Sort Key1:=Range("G5")

(Set dataRange = ActiveWorkbook.Sheets("source"). _
( Range(Cells(iStartDataRow, 1), _
( Cells(iMaxRowNumb, iMaxColNumb))

Thanks,
Peter.
 
Hi Tom,

Dim iCol As Integer
iCol = 7
dataRange.Sort Key1:=ActiveWorkbook.Sheets("source").Cells(5,
iCol)

When I try it I get "Appl-def'd or Obj-def'd error".

BTW what is the 5 for?

Thanks,
Peter.
 
UPDATE TO MY REPLY
(couldn't reply to myself)

I took the As Integer off my defn of iCol and it worked!

But haven't figured it out yet.

Thanks,
Peter.
 

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