ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Count series in range (https://www.excelbanter.com/excel-programming/341823-count-series-range.html)

rjhare

Count series in range
 

I am writing an Excel function in VBA, but I am stuck on this:

I need to count the number of series in a range:

A column has a several ranges of numbers, split by blank cells:

1
0.5
1


1
1
1
1
1

1
1

I need to count the series of numbers, which in this case 3: (1, 0.5,1
and (1,1,1,1,1) and (1,1)

How do I do this from a passed range in VBA, please

Thank

--
rjhar

-----------------------------------------------------------------------
rjhare's Profile: http://www.excelforum.com/member.php...fo&userid=1141
View this thread: http://www.excelforum.com/showthread.php?threadid=47293


Tom Ogilvy

Count series in range
 
rng.specialcells(xlconstants,xlnumbers).Areas.coun t

where rng represents the passed range.

--
Regards,
Tom Ogilvy

"rjhare" wrote in
message ...

I am writing an Excel function in VBA, but I am stuck on this:

I need to count the number of series in a range:

A column has a several ranges of numbers, split by blank cells:

1
0.5
1


1
1
1
1
1

1
1

I need to count the series of numbers, which in this case 3: (1, 0.5,1)
and (1,1,1,1,1) and (1,1)

How do I do this from a passed range in VBA, please

Thanks


--
rjhare


------------------------------------------------------------------------
rjhare's Profile:

http://www.excelforum.com/member.php...o&userid=11419
View this thread: http://www.excelforum.com/showthread...hreadid=472936




rjhare[_2_]

Count series in range
 

Thanks, but this did not work for me (XL2k on W2kSP4)

I have managed a workaround though.

Thanks to all those that viewe

--
rjhar

-----------------------------------------------------------------------
rjhare's Profile: http://www.excelforum.com/member.php...fo&userid=1141
View this thread: http://www.excelforum.com/showthread.php?threadid=47293


Tom Ogilvy

Count series in range
 
Great, but
Just others are not deceived by your inability to implement and are not
forced to employ some cumbersome workaround

from the immediate window:

set rng = Columns(1)
? rng.specialcells(xlconstants,xlnumbers).Areas.coun t
8


--
Regards,
Tom Ogilvy


"rjhare" wrote in
message ...

Thanks, but this did not work for me (XL2k on W2kSP4)

I have managed a workaround though.

Thanks to all those that viewed


--
rjhare


------------------------------------------------------------------------
rjhare's Profile:

http://www.excelforum.com/member.php...o&userid=11419
View this thread: http://www.excelforum.com/showthread...hreadid=472936





All times are GMT +1. The time now is 04:19 PM.

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