Finding the Total cell value across multiple Worksheets

b9k9uk

New Member
Joined
Jul 31, 2016
Messages
37
I have a WorkBook which produces weekly Time sheets for staff.

The first 3 sheets are the 'Admin' sheets; Start (produces week date and number copied across all sheets in VBA); Dutys (reads the Duty number and copies hours and time on duty) and Blank Time Sheets.

Each subsequent sheet is produced by copying Blank Time Sheets as new sheet (via VBA); renaming it to the Staff member name; Jones A; Smith A etc etc

The number of Sheets (Staff) varies as Staff leave/are recruited.

I need to find the Total Hours worked by all staff.

In this instance I need to reference cell H34 on each worksheet (excepting the first 3 sheets) and find the total (i.e. the cell value for H34 from each worksheet produces the Total Hours worked.)

I am currently using the formula ='Jones A'!H34 + 'Smith A'!H34 etc.

This is not very flexible as staff leave/are recruited as the Formula has to be edited each time staff leave/are recruited.

Is there a way to do this in vba?

Many thanks for reading this and hoping you can help.
 

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
Create two new sheets, name them First and Last. Then place all of the relevant sheets between First and Last. Now you can invoke:

=SUM(First:Last!H34)
 
Upvote 0
Doh! How simple it looks when you know the answer!

Many thanks Aladin; opens up all sorts of possiblities now.
 
Upvote 0

Forum statistics

Threads
1,223,893
Messages
6,175,239
Members
452,621
Latest member
Laura_PinksBTHFT

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