Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Dealing with range of numbers in a cell | Excel Worksheet Functions | |||
sum a range of numbers entered into a cell | New Users to Excel | |||
Range of numbers in a single cell | Excel Discussion (Misc queries) | |||
occurance of numbers in cell range | Excel Worksheet Functions | |||
Sum the first 10 numbers in a 26 cell range | Excel Programming |