Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 17
Default Problem coding a Sort

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.


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Problem coding a Sort

icol = 7
dataRange.Sort Key1:=worksheets("Source").Cells(5,icol)

--
Regards,
Tom Ogilvy


"Peter Chatterton" wrote in message
. ..
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.




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 17
Default Problem coding a Sort

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.

"Tom Ogilvy" wrote in message
...
icol = 7
dataRange.Sort Key1:=worksheets("Source").Cells(5,icol)

--
Regards,
Tom Ogilvy


"Peter Chatterton" wrote in message
. ..
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.






  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 17
Default Problem coding a Sort

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.


"Tom Ogilvy" wrote in message
...
icol = 7
dataRange.Sort Key1:=worksheets("Source").Cells(5,icol)

--
Regards,
Tom Ogilvy


"Peter Chatterton" wrote in message
. ..
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.






Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel VBA coding problem adubbs99 Excel Discussion (Misc queries) 2 April 6th 09 06:28 PM
Help with my coding problem? Dan the Man[_2_] Excel Worksheet Functions 3 September 11th 07 12:02 AM
First attempt at VBA coding problem Rick in NS New Users to Excel 9 January 12th 06 05:11 PM
Excel VBA : Coding Problem wuming[_16_] Excel Programming 2 July 28th 04 02:19 AM
Excel Coding Problem Fraggs[_14_] Excel Programming 3 April 20th 04 01:50 PM


All times are GMT +1. The time now is 01:56 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"