Adding workbook values to a summary workbook.

xzmike

Board Regular
Joined
Feb 15, 2002
Messages
110
I'm looping thru various workbooks and adding values in row 18, columns "H" thru "Q" to a workbook named Master with a sheet named Summary. In the code, when I reach the first cell of H18 in the workbook I'm looping thru, I want that value added to cell H18 of the Master.Summary workbook/sheet. When I loop thru the next workbook (code not shown) I want perform the same action. The end result is that Master.Summary H18 (and other cells) will have the summed values of the individual sheets.

For example, if I'm in cellH18 of the activeworkbook, I would like the code to saysomething like " Master.Summary.Range(H18).value=Master.Summary.Range(H18).value + Activeworkbook.Activesheet.Range(H18).value.

Thanks for any help
Mike


Dim rngTarget As Range
Dim wks As Worksheet

Set wks = ActiveSheet

For Each wks In ActiveWorkbook.Worksheets
Set rngTarget = wks.Range("H" &18 ":Q" & 18)
For Each rng In rngTarget
I'M NOT SURE WHAT CODE GOES IN HERE.
Next rng
Next

End Sub
 

Excel Facts

How to create a cell-sized chart?
Tiny charts, called Sparklines, were added to Excel 2010. Look for Sparklines on the Insert tab.
xzmike.

replace "NOT SURE WHAT TO PUT HERE"

with something like this:

Code:
rngTarget.Cells(1, i).Copy
Master.Summary.Cells(rngTarget.Cells(1,i).Address).PasteSpecial xlPasteValuesAndNumberFormats, xlPasteSpecialOperationAdd
you might have to .Select your Master before pasting...i never can remember if that is a problem or not.

hope this helps. ben.
 
Upvote 0

Forum statistics

Threads
1,214,638
Messages
6,120,674
Members
448,977
Latest member
moonlight6

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