VBA to display column count values of multiple worksheets

AGrace

Board Regular
Joined
Jun 29, 2010
Messages
150
Hi all,

I’m looking to create a simple summary worksheet that displays a count from the first column (a2:a5) for each worksheet in the workbook (104 – barring the first summary sheet). I was going to do this via a formula but would rather not do this 104 times for each worksheet, and wondered if there’s an easier way using VBA?

Thanks,

Adam
 
Thanks GTO, I haven't tried your suggestion yet (as i don't quite understand it :D) but it sounds like I'd get the total number for all the sheets rather than the total per sheet, or am I totally wrong here?
 
Upvote 0

Excel Facts

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop
On each worksheet there are tasks (1-4) displayed. Cells A2-A5 will have Task 1, 2, 3, 4 etc in them. I want the summary page to just look in these cells for each work book at count if there's a value (not the specific value of each cell though).

so sheet2 (the first sheet to look at) has 3 tasks, so next to that persons name on the summary there's a 3 count. Sheet3 has 0 tasks, so 0 next that name.

I hope that makes sense. I'm sure this is really simple to you guys, it's had me stumped.

Thanks,


Okay, I think I misunderstood. I think that you could use COUNTIF, but would need to include the different sheets' names.
 
Upvote 0
Not sure if this is what you're looking for, but something like this would work:
Excel Workbook
BC
4Sheet26
5Sheet319
6Sheet419
Sheet1
Excel 2007
Cell Formulas
RangeFormula
C4=SUM(INDIRECT(B4&"!A2:A5"))
C5=SUM(INDIRECT(B5&"!A2:A5"))
C6=SUM(INDIRECT(B6&"!A2:A5"))


I just used the default sheet names, but if your table and your tab names match, the above formula should work.
 
Upvote 0
the table and tabs have the same names but the formula seems to fail. It just displays a #REF!

Any thoughts?
 
Upvote 0
Can you post the formula as you have it typed?

in C2 I have:

Code:
=SUM(INDIRECT(B2&"!A2:A5"))

and it works on my end.
 
Upvote 0
Wait, I was wrong. If your tabs have a space in them, it needs to look like this:

Code:
=SUM(INDIRECT("'" & B2&"'!A2:A5"))

and copied down
 
Upvote 0
Just seen there is a second page of replies and this won't calculate what you what you're looking for.
 
Upvote 0

Forum statistics

Threads
1,224,616
Messages
6,179,912
Members
452,949
Latest member
beartooth91

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top