LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 85
Default Range as cell numbers

I have this line of code and I want to remove the hard-coded "N" and replace
it with the last column (lngMaxColumn retruned by SpecialCells).

objExcel.range("A1:N" & lngMaxRow).Sort Key1:="Date", Header:=xlYes

I have a routine which turns the column number into a letter, but I'd rather
use the column number if possible. I know I can change Range("N1") to
Cells(14,1), but how do you specify a range of cells in this way?

I've tried

With objExcel
.range(.cells(1, 1), .cells(lngMaxRow, lngMaxColumn)).Sort Key1:="Date",
Header:=xlYes
End With

but this returns "Run-time error '1004': Application defined or object
defined error" and appears to be to do with the .cells references.

Excel VBA Help gives Range(Cells(1, 1), Cells(5, 3)).Font.Italic = True as
an example, but I can't figure out how to adapt this to late-bound code. It
needs to be late-bound as it's running under Access.

Any ideas?

Ian


 
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
Dealing with range of numbers in a cell Penny Excel Worksheet Functions 5 May 4th 06 08:20 PM
sum a range of numbers entered into a cell paphos2006 New Users to Excel 3 March 2nd 06 10:38 PM
Range of numbers in a single cell DRB Excel Discussion (Misc queries) 2 January 12th 06 12:18 AM
occurance of numbers in cell range Dillenger Excel Worksheet Functions 14 February 21st 05 06:45 PM
Sum the first 10 numbers in a 26 cell range jester[_2_] Excel Programming 6 June 19th 04 04:33 PM


All times are GMT +1. The time now is 10:15 AM.

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

About Us

"It's about Microsoft Excel"