Hi,
I'm trying to use this code to sum the same cell across multiple worksheets in different ranges: ActiveCell.FormulaR1C1 = "=SUM('*'!D19)"
I have the following issue:
1) When I input the formula manually it works perfect but when I use VBA the cells throws the following error: #NAME?
I need to use the code above because the worksheets varies in number and names every time I run a different macro.
What am I missing?
Thanks,
WALDIR
This is the full macro:
[Code]
Sub SumSameCellAcrossMultipleSheets()
Dim r1 As Range
Dim r2 As Range
Dim r3 As Range
Set r1 = Range("D19:BK29")
Set r2 = Range("D35:BK46")
Set r3 = Range("D52:BK61")
Sheets("Template").Select
Range("D19").Select
ActiveCell.FormulaR1C1 = "=SUM('*'!D19)"
Range("D19").Select
Selection.Copy
r1.Select
Selection.PasteSpecial Paste:=xlPasteFormulas, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False
r2.Select
Selection.PasteSpecial Paste:=xlPasteFormulas, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False
r3.Select
Selection.PasteSpecial Paste:=xlPasteFormulas, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False
End Sub
[Code//]
Bookmarks