Sum cells within a range of cells from multiple worksheets to a master worksheet

kevinkangz1

New Member
Joined
Jan 18, 2019
Messages
1
Hello,

I'm a novice in Excel, please help on below situation:

From multiple worksheets, within a range of cells I want each cells to be added to a master worksheet.

For example,
from A1 to A8 in multiple worksheets, I want A1.value in multiple sheets to be added to Master worksheet.
and A2.Value in multiple sheets to be added to Master worksheet.

I understand below code will work:
Code:
Private Sub CommandButton1_Click()

Dim i As Long
Dim x As Long

x = 0

For i = 1 To ActiveWorkbook.Worksheets.Count

    x = x + Sheets(i).Range("J27").Value2 'Multiple worksheets
    
Next i

Sheet1.Range("A1").Value2 = x 'Master Worksheet/workbook

End Sub

But below code will only work for one cell only..
How can I do it for all cells within a range? I don't want to repeat above code for each cell to be added to the master worksheet, as there are more than 400 cells in my table.

Thank you
 

Excel Facts

Excel Joke
Why can't spreadsheets drive cars? They crash too often!
are you aware that you can sum by formula between the first sheet (here named January-17) and last sheet (here named April-17)

formula in Master
=SUM('January-17:April-17'!J27)
 
Last edited:
Upvote 0

Forum statistics

Threads
1,215,669
Messages
6,126,111
Members
449,292
Latest member
Mario BR

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