#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 80
Default count

Hi, if ive selected range("a5") with vba and id like ti count how many
number = to 21 are in a2:a5 then move to a9 and again count 21s in
a6:a9 and continue moving down the column. I can move down ok, just
dont know how to count for 21, in every 4 cells. Its important that its
every 4 cells and not 21s in the whole colums, because these are dailly
results which collect 4 values each day. Any ideas appreciated.
Regards Robert

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default count

Sub ShowCnt()
Dim lastrow as Long, i as Long
Dim rng as Range
lastrow = cells(rows.count,1).End(xlup).row
for i = 2 to lastrow step 4
set rng = cells(i,4).Resize(4,1)
cnt = application.Countif(rng,21)
msgbox rng.Address & ": " & cnt
Next
End Sub


wrote in message
oups.com...
Hi, if ive selected range("a5") with vba and id like ti count how many
number = to 21 are in a2:a5 then move to a9 and again count 21s in
a6:a9 and continue moving down the column. I can move down ok, just
dont know how to count for 21, in every 4 cells. Its important that its
every 4 cells and not 21s in the whole colums, because these are dailly
results which collect 4 values each day. Any ideas appreciated.
Regards Robert



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 80
Default count

Thanks Tom brilliant.
Regards Robert

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Multiple Criteria, Count If, Sum Product to get count across range Jonathan Excel Worksheet Functions 5 January 9th 08 11:32 PM
Count Employee Work Time - Don't Count Duplicates J Excel Worksheet Functions 3 May 1st 07 10:47 PM
Count Employee Work Time - Don't Double-count Overlapping Apts. J Excel Worksheet Functions 0 April 27th 07 05:52 AM
Excel 2000, count, sort a list & count totals? sunslight Excel Worksheet Functions 1 April 9th 07 05:46 PM
Count Intervals of Filtered TEXT values in Column and Return Count across a Row Sam via OfficeKB.com Excel Worksheet Functions 9 July 31st 05 03:37 AM


All times are GMT +1. The time now is 02:17 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"