ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How to count number of items(cells) in range? (https://www.excelbanter.com/excel-programming/347275-how-count-number-items-cells-range.html)

George Furnell[_2_]

How to count number of items(cells) in range?
 
Hi,
In a function I receive the range of cells as type range, now before using
it I want to count the number of cells in the range. please indicate how I do
this since I am unable to find a solution.
Kind regards

George

[email protected]

How to count number of items(cells) in range?
 
Hi George,

Range("A1:A25").cells.count

or

dim r as range
r = ...some range operation
debug.print r.cells.count

HTH,
Bernd


George Furnell[_2_]

How to count number of items(cells) in range?
 
Thak you

Niek Otten

How to count number of items(cells) in range?
 
Better, if you receive the range as an argument (which you should):

a.Cells.Count (if a was the range)

Never access worksheet cells directly in a function, always supply them as
an argument

--
Kind regards,

Niek Otten

wrote in message
oups.com...
Hi George,

Range("A1:A25").cells.count

or

dim r as range
r = ...some range operation
debug.print r.cells.count

HTH,
Bernd




George Furnell[_2_]

How to count number of items(cells) in range?
 
Appreciated.

George


All times are GMT +1. The time now is 11:41 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com