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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Range of Rows

Status
Not open for further replies.

123FakeSt

IS-IT--Management
Aug 4, 2003
182
What's the easiest way to set a range to variable rows?

Rather than:
Set xlRng = Rows("1:4")

I need it to be dynamic:

iStartRow = 1
iEndRow = 4

Set xlRng = Rows(iStartRow:iEndRow)

Thanks!

The early bird gets the worm, but the second mouse gets the cheese.
 
OK I figured it out .. it's

Set xlRng = Rows(iStartRow & ":" & iEndRow)

Thanks

The early bird gets the worm, but the second mouse gets the cheese.
 




Hi,

A slightly better way, rather than formatting a string, is
Code:
Set xlRng = range(Rows(iStartRow), Rows(iEndRow))


Skip,

[glasses] When a wee mystic is on the loose..
It's a Small Medium at Large! [tongue]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top