Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CreateRange in Excel with vbs/asp

Status
Not open for further replies.

bastienk

Programmer
Joined
Mar 3, 2004
Messages
326
Location
CA
How do i create the range for a certain area in the excel spreadsheet? I can get the width and height of the range with
Code:
intCols    = xlsheet.UsedRange.Columns.Count
lngNumRows = xlsheet.UsedRange.Rows.Count

I am just unsure as to how to syntactically create the statement needed.

TIA


Bastien

Cat, the other other white meat
 
Which Range ?
Something like this ?
Set myRange=xlsheet.Range("A1:C5")
With xlsheet
Set myRange=.Range(.Cells(BegRow,BegCol),.Cells(EndRow,EndCol))
End With
Anyway, the correct size of the used range is:
With xlsheet.UsedRange
intCols = .Columns.Count - .Column + 1
lngNumRows = .Rows.Count - .Row + 1
End With

Hope This Help, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top