Determining the size of a range.

  • Thread starter Thread starter Dave the wave
  • Start date Start date
D

Dave the wave

Is there a means for discovering the size of a particular range? (Like, how
many rows or columns are in the range.) (Using VBA, of course.)
 
iRows=Selection.Rows.Count
iColumns = Selection.Columns.Count

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 
Thanks!
--
from
Dave the wave~~~~~

Bob Phillips said:
iRows=Selection.Rows.Count
iColumns = Selection.Columns.Count

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 
Dave,

Try this

Dim rngTest as range
set rngTest = selection
debug.print rngTest.Count 'number of cells
debug.print rngTest.Columns.Count 'number of columns
debug.print rngTest.Rows.Count 'number of rows

Robin Hammond
www.enhanceddatasystems.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top