rsdjimbie
Mar 12, 2012, 01:49 PM
I need to to copy and paste to multiple sheets where the sheet names are not static.
All it involves is the copy and paste of a formula to all the sheets in the workbook without having to refer to every book as the names of these change.
Code I am using currently =
ActiveWorkbook.Sheets.Select
Range("M3").Select
ActiveCell.FormulaR1C1 = _
"=IF(RC[-8]="""",RC[-1],IF(COUNTIF(R1C[-8]:RC[-8],RC[-8])>1,"""",SUMIF(R1C[-8]:R[25]C[-8],RC[-8],R1C[-1]:R[25]C[-1])))"
Range("
Range(").Select
Selection.Copy
Range("M4:M100").Select.Paste
Application.CutCopyMode = False]
But the macro will not copy the formula to the specified ranges.
Thanks!
All it involves is the copy and paste of a formula to all the sheets in the workbook without having to refer to every book as the names of these change.
Code I am using currently =
ActiveWorkbook.Sheets.Select
Range("M3").Select
ActiveCell.FormulaR1C1 = _
"=IF(RC[-8]="""",RC[-1],IF(COUNTIF(R1C[-8]:RC[-8],RC[-8])>1,"""",SUMIF(R1C[-8]:R[25]C[-8],RC[-8],R1C[-1]:R[25]C[-1])))"
Range("
Range(").Select
Selection.Copy
Range("M4:M100").Select.Paste
Application.CutCopyMode = False]
But the macro will not copy the formula to the specified ranges.
Thanks!