# Insert Macro multiple worksheets

#### bloodybrit90

##### Board Regular
Hey guy,

Below is a macro that I recorded earlier. I know it's poorly written (recorded). This will be used to update several workbooks which are the exact same. I have found a few errors below. I originally copied a formula from another workbook and used that to paste into my new workbook. It appears the macro did not copy the formula from the other workbook.

How do I insert a formula into the macro? What is the statement? If you are not sure where I need the formulas inserted I can use the debuging to find where they need to be inserted.

Here are the formulas I need to insert.

F61=IF(F16="","",(-PV(assessintrate,Adjustments!\$C\$45,'KB Data'!\$L17*(AVERAGE('KB Data'!\$P41:\$AA41)*assessdiv))*Adjustments!\$C\$46))

F38=IF(F\$16="","",IF('KB Data'!\$X13=1,"Front",IF('KB Data'!\$X13=2,"Full","None")))

Any help would be appreciated.

Sub Update_CMA()
'
' Update_CMA Macro
' Updates 5-12 CMA with new CMA 6-22-12
'
' Keyboard Shortcut: Ctrl+p
'
Range("X18").Select
ActiveCell.FormulaR1C1 = _
"=IF(RC[-23]="""","""",IF('C1'!R17C12="""",(('KB Data'!R17C12-0.01)*AVERAGE(R[1]C[-12]:R[12]C[-12])),'C1'!R18C12+(('C1'!R17C12-0.01)*AVERAGE(R[1]C[-12]:R[12]C[-12]))))"
Range("X18").Select
Selection.Copy
Range("X31").Select
ActiveSheet.Paste
Range("X44").Select
ActiveSheet.Paste
Range("X57").Select
ActiveSheet.Paste
Range("X70").Select
ActiveSheet.Paste
Range("X83").Select
ActiveSheet.Paste
Range("X96").Select
ActiveSheet.Paste
Range("X109").Select
ActiveSheet.Paste
Range("X20").Select
Application.CutCopyMode = False
Range("X31").Select
ActiveCell.FormulaR1C1 = _
"=IF(RC[-23]="""","""",IF('C2'!R17C12="""",(('KB Data'!R17C12-0.01)*AVERAGE(R[1]C[-12]:R[12]C[-12])),'C2'!R18C12+(('C1'!R17C12-0.01)*AVERAGE(R[1]C[-12]:R[12]C[-12]))))"
Range("X44").Select
ActiveCell.FormulaR1C1 = _
"=IF(RC[-23]="""","""",IF('C3'!R17C12="""",(('KB Data'!R17C12-0.01)*AVERAGE(R[1]C[-12]:R[12]C[-12])),'C3'!R18C12+(('C3'!R17C12-0.01)*AVERAGE(R[1]C[-12]:R[12]C[-12]))))"
Range("X31").Select
ActiveCell.FormulaR1C1 = _
"=IF(RC[-23]="""","""",IF('C2'!R17C12="""",(('KB Data'!R17C12-0.01)*AVERAGE(R[1]C[-12]:R[12]C[-12])),'C2'!R18C12+(('C2'!R17C12-0.01)*AVERAGE(R[1]C[-12]:R[12]C[-12]))))"
Range("X57").Select
ActiveCell.FormulaR1C1 = _
"=IF(RC[-23]="""","""",IF('C4'!R17C12="""",(('KB Data'!R17C12-0.01)*AVERAGE(R[1]C[-12]:R[12]C[-12])),'C4'!R18C12+(('C4'!R17C12-0.01)*AVERAGE(R[1]C[-12]:R[12]C[-12]))))"
Range("X70").Select
ActiveCell.FormulaR1C1 = _
"=IF(RC[-23]="""","""",IF('C5'!R17C12="""",(('KB Data'!R17C12-0.01)*AVERAGE(R[1]C[-12]:R[12]C[-12])),'C5'!R18C12+(('C5'!R17C12-0.01)*AVERAGE(R[1]C[-12]:R[12]C[-12]))))"
Range("X83").Select
ActiveCell.FormulaR1C1 = _
"=IF(RC[-23]="""","""",IF('C6'!R17C12="""",(('KB Data'!R17C12-0.01)*AVERAGE(R[1]C[-12]:R[12]C[-12])),'C6'!R18C12+(('C6'!R17C12-0.01)*AVERAGE(R[1]C[-12]:R[12]C[-12]))))"
Range("X96").Select
ActiveCell.FormulaR1C1 = _
"=IF(RC[-23]="""","""",IF('C7'!R17C12="""",(('KB Data'!R17C12-0.01)*AVERAGE(R[1]C[-12]:R[12]C[-12])),'C7'!R18C12+(('C7'!R17C12-0.01)*AVERAGE(R[1]C[-12]:R[12]C[-12]))))"
Range("X109").Select
ActiveCell.FormulaR1C1 = _
"=IF(RC[-23]="""","""",IF('C8'!R17C12="""",(('KB Data'!R17C12-0.01)*AVERAGE(R[1]C[-12]:R[12]C[-12])),'C8'!R18C12+(('C8'!R17C12-0.01)*AVERAGE(R[1]C[-12]:R[12]C[-12]))))"
Range("X122").Select
ActiveSheet.Next.Select
ActiveSheet.Next.Select
ActiveSheet.Next.Select
ActiveSheet.Next.Select
ActiveSheet.Next.Select
Range("A61").Select
Sheets(Array("cma1", "cma2", "cma3", "cma4", "cma5", "cma6", "cma7", "cma8")).Select
Sheets("cma1").Activate
Rows("61:61").Select
Selection.Insert Shift:=xlDown
Sheets("cma2").Select
ActiveWindow.SmallScroll Down:=18
Sheets("cma3").Select
ActiveWindow.SmallScroll Down:=33
Sheets(Array("cma1", "cma2", "cma3", "cma4", "cma5", "cma6", "cma7", "cma8")).Select
Sheets("cma1").Activate
Range("A61").Select
ActiveCell.FormulaR1C1 = "Tax Rate"
Range("F61").Select
ActiveSheet.Paste
Selection.Copy
Range("I61").Select
ActiveSheet.Paste
Range("L61").Select
ActiveSheet.Paste
Range("O61").Select
ActiveSheet.Paste
Range("R61").Select
ActiveSheet.Paste
Range("U61").Select
ActiveSheet.Paste
Range("A61").Select
Application.CutCopyMode = False
Range("D61").Select
ActiveCell.FormulaR1C1 = "varies"
Range("G61").Select
ActiveSheet.Paste
Range("G61").Select
Selection.Copy
Range("J61").Select
ActiveSheet.Paste
Range("M61").Select
ActiveSheet.Paste
Range("P61").Select
ActiveSheet.Paste
Range("S61").Select
ActiveSheet.Paste
Range("V61").Select
ActiveSheet.Paste
Range("E61").Select
Application.CutCopyMode = False
Range("H61").Select
ActiveSheet.Paste
Range("K61").Select
ActiveSheet.Paste
Range("N61").Select
ActiveSheet.Paste
Range("Q61").Select
ActiveSheet.Paste
Range("T61").Select
ActiveSheet.Paste
Range("W61").Select
ActiveSheet.Paste
Range("U61").Select
ActiveSheet.Next.Select
ActiveSheet.Next.Select
ActiveSheet.Next.Select
ActiveSheet.Next.Select
ActiveSheet.Next.Select
ActiveSheet.Next.Select
ActiveSheet.Next.Select
ActiveSheet.Next.Select
ActiveSheet.Next.Select
ActiveSheet.Next.Select
ActiveSheet.Next.Select
ActiveSheet.Next.Select
ActiveSheet.Next.Select
ActiveSheet.Next.Select
ActiveSheet.Next.Select
ActiveSheet.Next.Select
ActiveSheet.Next.Select
ActiveSheet.Next.Select
ActiveSheet.Next.Select
ActiveSheet.Next.Select
ActiveSheet.Previous.Select
ActiveSheet.Next.Select
ActiveSheet.Next.Select
ActiveSheet.Next.Select
ActiveSheet.Next.Select
ActiveSheet.Next.Select
Range("A10").Select
Selection.End(xlDown).Select
Selection.End(xlDown).Select
Selection.End(xlDown).Select
Selection.End(xlDown).Select
Range("A45").Select
ActiveSheet.Paste
Range("A46").Select
ActiveSheet.Previous.Select
ActiveSheet.Previous.Select
ActiveSheet.Previous.Select
ActiveSheet.Previous.Select
ActiveSheet.Previous.Select
ActiveSheet.Previous.Select
ActiveSheet.Previous.Select
ActiveSheet.Previous.Select
ActiveSheet.Previous.Select
ActiveSheet.Previous.Select
ActiveSheet.Previous.Select
ActiveSheet.Previous.Select
ActiveSheet.Previous.Select
ActiveSheet.Previous.Select
ActiveSheet.Previous.Select
ActiveSheet.Previous.Select
ActiveSheet.Previous.Select
ActiveSheet.Previous.Select
ActiveSheet.Previous.Select
ActiveSheet.Previous.Select
ActiveSheet.Previous.Select
ActiveSheet.Previous.Select
ActiveSheet.Previous.Select
ActiveSheet.Previous.Select
ActiveSheet.Previous.Select
ActiveSheet.Next.Select
Range("H61").Select
Selection.Copy
Range("K61").Select
ActiveSheet.Paste
Range("N61").Select
ActiveSheet.Paste
Range("Q61").Select
ActiveSheet.Paste
Range("T61").Select
ActiveSheet.Paste
Range("W61").Select
ActiveSheet.Paste
Range("T61").Select
Application.CutCopyMode = False
Range("F58").Select
ActiveSheet.Next.Select
Range("G61").Select
ActiveCell.FormulaR1C1 = _
"=IF(R[-45]C="""","""",IF('C2'!R17C12="""",(-PV(assessintrate,Adjustments!R45C3,'KB Data'!R17C12*(AVERAGE('C2'!R[-20]C16:R[-20]C27)*assessdiv))),(-PV(assessintrate,Adjustments!R45C3,'C2'!R[-44]C12*(AVERAGE('C2'!R[-20]C16:R[-20]C27)*assessdiv))))*Adjustments!R46C3)"
Range("G61").Select
Selection.Copy
Range("J61").Select
ActiveSheet.Paste
Range("M61").Select
ActiveSheet.Paste
Range("P61").Select
ActiveSheet.Paste
Range("S61").Select
ActiveSheet.Paste
Range("V61").Select
ActiveSheet.Paste
Range("U61").Select
ActiveSheet.Next.Select
Range("G61").Select
Application.CutCopyMode = False
ActiveCell.FormulaR1C1 = _
"=IF(R[-45]C="""","""",IF('C3'!R17C12="""",(-PV(assessintrate,Adjustments!R45C3,'KB Data'!R17C12*(AVERAGE('C3'!R[-20]C16:R[-20]C27)*assessdiv))),(-PV(assessintrate,Adjustments!R45C3,'C3'!R[-44]C12*(AVERAGE('C3'!R[-20]C16:R[-20]C27)*assessdiv))))*Adjustments!R46C3)"
Range("G61").Select
Selection.Copy
Range("J61").Select
ActiveSheet.Paste
Range("M61").Select
ActiveSheet.Paste
Range("P61").Select
ActiveSheet.Paste
Range("S61").Select
ActiveSheet.Paste
Range("V61").Select
ActiveSheet.Paste
Range("G61").Select
Sheets(Array("cma2", "cma3", "cma4", "cma5", "cma6", "cma7", "cma8")).Select
Sheets("cma2").Activate
Range("H61").Select
Application.CutCopyMode = False
Selection.Copy
Range("K61").Select
ActiveSheet.Paste
Range("N61").Select
ActiveSheet.Paste
Range("Q61").Select
ActiveSheet.Paste
Range("T61").Select
ActiveSheet.Paste
Range("W61").Select
ActiveSheet.Paste
Application.CutCopyMode = False
Sheets("cma3").Select
Range("J61").Select
ActiveSheet.Next.Select
Range("G61").Select
ActiveCell.FormulaR1C1 = _
"=IF(R[-45]C="""","""",IF('C4'!R17C12="""",(-PV(assessintrate,Adjustments!R45C3,'KB Data'!R17C12*(AVERAGE('C4'!R[-20]C16:R[-20]C27)*assessdiv))),(-PV(assessintrate,Adjustments!R45C3,'C4'!R[-44]C12*(AVERAGE('C4'!R[-20]C16:R[-20]C27)*assessdiv))))*Adjustments!R46C3)"
Range("G61").Select
Selection.Copy
Range("J61").Select
ActiveSheet.Paste
Range("M61").Select
ActiveSheet.Paste
Range("P61").Select
ActiveSheet.Paste
Range("S61").Select
ActiveSheet.Paste
Range("V61").Select
ActiveSheet.Paste
Range("A61").Select
ActiveSheet.Next.Select
Range("G61").Select
Application.CutCopyMode = False
ActiveCell.FormulaR1C1 = _
"=IF(R[-45]C="""","""",IF('C5'!R17C12="""",(-PV(assessintrate,Adjustments!R45C3,'KB Data'!R17C12*(AVERAGE('C5'!R[-20]C16:R[-20]C27)*assessdiv))),(-PV(assessintrate,Adjustments!R45C3,'C5'!R[-44]C12*(AVERAGE('C5'!R[-20]C16:R[-20]C27)*assessdiv))))*Adjustments!R46C3)"
Range("G61").Select
Selection.Copy
Range("J61").Select
ActiveSheet.Paste
Range("M61").Select
ActiveSheet.Paste
Range("P61").Select
ActiveSheet.Paste
Range("S61").Select
ActiveSheet.Paste
Range("V61").Select
ActiveSheet.Paste
Range("A61").Select
ActiveSheet.Next.Select
Range("G61").Select
Application.CutCopyMode = False
ActiveCell.FormulaR1C1 = _
"=IF(R[-45]C="""","""",IF('C6'!R17C12="""",(-PV(assessintrate,Adjustments!R45C3,'KB Data'!R17C12*(AVERAGE('C6'!R[-20]C16:R[-20]C27)*assessdiv))),(-PV(assessintrate,Adjustments!R45C3,'C6'!R[-44]C12*(AVERAGE('C6'!R[-20]C16:R[-20]C27)*assessdiv))))*Adjustments!R46C3)"
Range("G61").Select
Selection.Copy
Range("J61").Select
ActiveSheet.Paste
Range("M61").Select
ActiveSheet.Paste
Range("P61").Select
ActiveSheet.Paste
Range("S61").Select
ActiveSheet.Paste
Range("A61").Select
ActiveSheet.Next.Select
Range("G61").Select
Application.CutCopyMode = False
ActiveCell.FormulaR1C1 = _
"=IF(R[-45]C="""","""",IF('C7'!R17C12="""",(-PV(assessintrate,Adjustments!R45C3,'KB Data'!R17C12*(AVERAGE('C7'!R[-20]C16:R[-20]C27)*assessdiv))),(-PV(assessintrate,Adjustments!R45C3,'C7'!R[-44]C12*(AVERAGE('C7'!R[-20]C16:R[-20]C27)*assessdiv))))*Adjustments!R46C3)"
Range("G61").Select
Selection.Copy
Range("J61").Select
ActiveSheet.Paste
Range("M61").Select
ActiveSheet.Paste
Range("P61").Select
ActiveSheet.Paste
Range("S61").Select
ActiveSheet.Paste
Range("V61").Select
ActiveSheet.Paste
Range("A61").Select
ActiveSheet.Next.Select
Range("G61").Select
Application.CutCopyMode = False
ActiveCell.FormulaR1C1 = _
"=IF(R[-45]C="""","""",IF('C8'!R17C12="""",(-PV(assessintrate,Adjustments!R45C3,'KB Data'!R17C12*(AVERAGE('C8'!R[-20]C16:R[-20]C27)*assessdiv))),(-PV(assessintrate,Adjustments!R45C3,'C8'!R[-44]C12*(AVERAGE('C8'!R[-20]C16:R[-20]C27)*assessdiv))))*Adjustments!R46C3)"
Range("G61").Select
Selection.Copy
Range("J61").Select
ActiveSheet.Paste
Range("M61").Select
ActiveSheet.Paste
Range("P61").Select
ActiveSheet.Paste
Range("S61").Select
ActiveSheet.Paste
Range("V61").Select
ActiveSheet.Paste
Range("G61").Select
Application.CutCopyMode = False
ActiveWindow.SmallScroll Down:=12
Range("F65").Select
Sheets(Array("cma1", "cma2", "cma3", "cma4", "cma5", "cma6", "cma7", "cma8")).Select
Sheets("cma8").Activate
ActiveCell.FormulaR1C1 = _
"=IF(R16C="""","""",'KB Data'!R19C12+'KB Data'!R20C12+('KB Data'!R18C12/12))"
Range("F65").Select
Selection.Copy
Range("I65").Select
ActiveSheet.Paste
Range("L65").Select
ActiveSheet.Paste
Range("O65").Select
ActiveSheet.Paste
ActiveWindow.SmallScroll Down:=-3
Range("R65").Select
ActiveSheet.Paste
Range("U65").Select
ActiveSheet.Paste
Range("G65").Select
Application.CutCopyMode = False
ActiveSheet.Next.Select
ActiveSheet.Next.Select
ActiveSheet.Next.Select
ActiveSheet.Next.Select
ActiveSheet.Next.Select
ActiveSheet.Next.Select
ActiveSheet.Next.Select
ActiveSheet.Next.Select
ActiveSheet.Next.Select
ActiveCell.FormulaR1C1 = _
"=IF(R16C="""","""",'C8'!R19C12+'C8'!R20C12+('C8'!R18C12/12))"
Range("G65").Select
Selection.Copy
Range("J65").Select
ActiveSheet.Paste
Range("M65").Select
ActiveSheet.Paste
Range("P65").Select
ActiveSheet.Paste
Range("S65").Select
ActiveSheet.Paste
Range("V65").Select
ActiveSheet.Paste
Range("X65").Select
Sheets("cma1").Select
Range("G65").Select
Application.CutCopyMode = False
ActiveCell.FormulaR1C1 = _
"=IF(R16C="""","""",'C1'!R19C12+'C1'!R20C12+('C1'!R18C12/12))"
Range("J65").Select
ActiveCell.FormulaR1C1 = _
"=IF(R16C="""","""",'C1'!R19C12+'C1'!R20C12+('C1'!R18C12/12))"
Range("G65").Select
Selection.Copy
Range("J65").Select
ActiveSheet.Paste
Range("M65").Select
ActiveSheet.Paste
Range("P65").Select
ActiveSheet.Paste
Range("S65").Select
ActiveSheet.Paste
Range("V65").Select
ActiveSheet.Paste
Range("A65").Select
ActiveSheet.Next.Select
Range("G65").Select
Application.CutCopyMode = False
ActiveCell.FormulaR1C1 = _
"=IF(R16C="""","""",'C2'!R19C12+'C2'!R20C12+('C2'!R18C12/12))"
Range("G65").Select
Selection.Copy
Range("J65").Select
ActiveSheet.Paste
Range("M65").Select
ActiveSheet.Paste
Range("P65").Select
ActiveSheet.Paste
Range("S65").Select
ActiveSheet.Paste
Range("V65").Select
ActiveSheet.Paste
Range("X65").Select
ActiveSheet.Next.Select
ActiveSheet.Next.Select
ActiveSheet.Next.Select
ActiveSheet.Next.Select
ActiveSheet.Next.Select
ActiveSheet.Next.Select
ActiveSheet.Next.Select
ActiveSheet.Next.Select
ActiveSheet.Next.Select
ActiveSheet.Previous.Select
ActiveSheet.Previous.Select
ActiveSheet.Previous.Select
ActiveSheet.Previous.Select
ActiveSheet.Previous.Select
ActiveSheet.Previous.Select
ActiveSheet.Previous.Select
ActiveSheet.Previous.Select
ActiveSheet.Previous.Select
ActiveSheet.Previous.Select
ActiveSheet.Previous.Select
ActiveSheet.Previous.Select
ActiveSheet.Next.Select
ActiveSheet.Next.Select
ActiveSheet.Next.Select
ActiveSheet.Next.Select
Range("G65").Select
Application.CutCopyMode = False
ActiveCell.FormulaR1C1 = _
"=IF(R16C="""","""",'C3'!R19C12+'C3'!R20C12+('C3'!R18C12/12))"
Range("G65").Select
Selection.Copy
Range("J65").Select
ActiveSheet.Paste
Range("M65").Select
ActiveSheet.Paste
Range("P65").Select
ActiveSheet.Paste
Range("S65").Select
ActiveSheet.Paste
Range("V65").Select
ActiveSheet.Paste
Range("A65").Select
ActiveSheet.Next.Select
Range("G65").Select
Application.CutCopyMode = False
ActiveCell.FormulaR1C1 = _
"=IF(R16C="""","""",'C4'!R19C12+'C4'!R20C12+('C4'!R18C12/12))"
Range("G65").Select
Selection.Copy
Range("J65").Select
ActiveSheet.Paste
Range("M65").Select
ActiveSheet.Paste
Range("P65").Select
ActiveSheet.Paste
Range("S65").Select
ActiveSheet.Paste
Range("V65").Select
ActiveSheet.Paste
Range("A65").Select
ActiveSheet.Next.Select
Range("G65").Select
Application.CutCopyMode = False
ActiveCell.FormulaR1C1 = _
"=IF(R16C="""","""",'C5'!R19C12+'C5'!R20C12+('C5'!R18C12/12))"
Range("G65").Select
Selection.Copy
Range("J65").Select
ActiveSheet.Paste
Range("M65").Select
ActiveSheet.Paste
Range("P65").Select
ActiveSheet.Paste
Range("S65").Select
ActiveSheet.Paste
Range("V65").Select
ActiveSheet.Paste
Range("D65").Select
Application.CutCopyMode = False
Range("H65").Select
ActiveSheet.Next.Select
Range("G65").Select
ActiveCell.FormulaR1C1 = _
"=IF(R16C="""","""",'C6'!R19C12+'C6'!R20C12+('C6'!R18C12/12))"
Range("G65").Select
Selection.Copy
Range("J65").Select
ActiveSheet.Paste
Range("M65").Select
ActiveSheet.Paste
Range("P65").Select
ActiveSheet.Paste
Range("S65").Select
ActiveSheet.Paste
Range("V65").Select
ActiveSheet.Paste
Range("G65").Select
ActiveSheet.Next.Select
Range("G65").Select
Application.CutCopyMode = False
ActiveCell.FormulaR1C1 = _
"=IF(R16C="""","""",'C7'!R19C12+'C7'!R20C12+('C7'!R18C12/12))"
Range("G65").Select
Selection.Copy
Range("J65").Select
ActiveSheet.Paste
Range("M65").Select
ActiveSheet.Paste
Range("P65").Select
ActiveSheet.Paste
Range("S65").Select
ActiveSheet.Paste
Range("V65").Select
ActiveSheet.Paste
Range("A65").Select
ActiveSheet.Next.Select
Range("G65").Select
Sheets(Array("cma1", "cma2", "cma3", "cma4", "cma5", "cma6", "cma7", "cma8")).Select
Sheets("cma8").Activate
Range("H65").Select
Application.CutCopyMode = False
ActiveSheet.Next.Select
ActiveSheet.Next.Select
ActiveSheet.Next.Select
ActiveSheet.Next.Select
ActiveSheet.Next.Select
ActiveSheet.Next.Select
ActiveSheet.Next.Select
ActiveSheet.Next.Select
ActiveSheet.Next.Select
ActiveSheet.Next.Select
ActiveSheet.Next.Select
ActiveSheet.Next.Select
ActiveSheet.Next.Select
ActiveSheet.Next.Select
ActiveSheet.Next.Select
ActiveSheet.Next.Select
ActiveSheet.Next.Select
ActiveCell.FormulaR1C1 = _
"=IF(RC[-2]="""","""",(-PV(assessintrate,Adjustments!R45C3,RC[-1]*12)*assessdiv)-(-PV(assessintrate,Adjustments!R45C3,RC[-2]*12)*assessdiv))"
Range("H65").Select
Selection.Copy
Range("K65").Select
ActiveSheet.Paste
Range("N65").Select
ActiveSheet.Paste
Range("Q65").Select
ActiveSheet.Paste
Range("T65").Select
ActiveSheet.Paste
Range("W65").Select
ActiveSheet.Paste
Range("Y65").Select
Sheets("C2").Select
ActiveSheet.Previous.Select
ActiveSheet.Previous.Select
ActiveSheet.Previous.Select
ActiveSheet.Previous.Select
ActiveSheet.Next.Select
ActiveSheet.Previous.Select
Range("H65").Select
ActiveSheet.Previous.Select
ActiveSheet.Previous.Select
ActiveSheet.Previous.Select
ActiveSheet.Previous.Select
ActiveSheet.Previous.Select
ActiveSheet.Previous.Select
Range("H65").Select
Application.CutCopyMode = False
Selection.Copy
Range("H61").Select
ActiveSheet.Paste
Range("H61").Select
Application.CutCopyMode = False
ActiveCell.FormulaR1C1 = _
"=IF(RC[-2]="""","""",(-PV(assessintrate,Adjustments!R45C3,RC[-1]*12)*assessdiv)-(-PV(assessintrate,Adjustments!R45C3,RC[-2]*12)*assessdiv)*Adjustments!R46C3)"
Range("H61").Select
ActiveCell.FormulaR1C1 = _
"=IF(RC[-2]="""","""",(-PV(assessintrate,Adjustments!R45C3,RC[-1]*12)*assessdiv)-(-PV(assessintrate,Adjustments!R45C3,RC[-2]*12)*assessdiv)*djustments!R46C3)"
Range("H61").Select
Selection.ClearContents
Range("K61").Select
Selection.Copy
Range("H61").Select
ActiveSheet.Paste
Range("A38").Select
Application.CutCopyMode = False
ActiveCell.FormulaR1C1 = "Landscaping"
Range("F38").Select
ActiveCell.FormulaR1C1 = _
"=IF(R16C="""","""",IF('KB Data'!R[-25]C24=1,""Front"",IF('KB Data'!R[-25]C24=2,""Full"",""None"")))"
Range("F38").Select
Selection.Copy
Range("I38").Select
ActiveSheet.Paste
Range("L38").Select
ActiveSheet.Paste
Range("O38").Select
ActiveSheet.Paste
Range("R38").Select
ActiveSheet.Paste
Range("U38").Select
ActiveSheet.Paste
Range("F38").Select
Sheets(Array("cma1", "cma2", "cma3", "cma4", "cma5", "cma6", "cma7", "cma8")).Select
Sheets("cma1").Activate
Range("F38").Select
Application.CutCopyMode = False
Selection.Copy
ActiveSheet.Paste
Range("I38").Select
ActiveSheet.Paste
Range("L38").Select
ActiveSheet.Paste
Range("O38").Select
ActiveSheet.Paste
Range("R38").Select
ActiveSheet.Paste
Range("U38").Select
ActiveSheet.Paste
Range("S38").Select
Application.CutCopyMode = False
Range("G38").Select
ActiveCell.FormulaR1C1 = _
"=IF(R16C="""","""",IF('C1'!R[-25]C24=1,""Front"",IF('C1'!R[-25]C24=2,""Full"",""None"")))"
Range("G38").Select
Selection.Copy
Range("J38").Select
ActiveSheet.Paste
Range("M38").Select
ActiveSheet.Paste
Range("P38").Select
ActiveSheet.Paste
Range("R38").Select
Selection.End(xlToRight).Select
Range("S38").Select
ActiveSheet.Paste
Range("V38").Select
ActiveSheet.Paste
Range("E38").Select
Sheets("cma1").Select
Range("G38").Select
Sheets("cma2").Select
Range("G38").Select
Application.CutCopyMode = False
ActiveCell.FormulaR1C1 = _
"=IF(R16C="""","""",IF('C2'!R[-25]C24=1,""Front"",IF('C2'!R[-25]C24=2,""Full"",""None"")))"
Range("J38").Select
ActiveCell.FormulaR1C1 = _
"=IF(R16C="""","""",IF('C1'!R[-25]C24=1,""Front"",IF('C1'!R[-25]C24=2,""Full"",""None"")))"
Range("G38").Select
Selection.Copy
Range("J38").Select
ActiveSheet.Paste
Range("M38").Select
ActiveSheet.Paste
Range("P38").Select
ActiveSheet.Paste
Range("S38").Select
ActiveSheet.Paste
Range("V38").Select
ActiveSheet.Paste
Range("E38").Select
ActiveSheet.Previous.Select
Range("H38").Select
ActiveSheet.Next.Select
Range("H38").Select
ActiveSheet.Next.Select
Range("G38").Select
Application.CutCopyMode = False
ActiveCell.FormulaR1C1 = _
"=IF(R16C="""","""",IF('C3'!R[-25]C24=1,""Front"",IF('C3'!R[-25]C24=2,""Full"",""None"")))"
Range("G38").Select
Selection.Copy
Range("J38").Select
ActiveSheet.Paste
Range("M38").Select
ActiveSheet.Paste
Range("P38").Select
ActiveSheet.Paste
Range("S38").Select
ActiveSheet.Paste
Range("V38").Select
ActiveSheet.Paste
Range("G38").Select
ActiveSheet.Next.Select
Range("G38").Select
ActiveSheet.Previous.Select
Range("G38").Select
ActiveSheet.Next.Select
Range("G38").Select
Application.CutCopyMode = False
ActiveCell.FormulaR1C1 = _
"=IF(R16C="""","""",IF('C4'!R[-25]C24=1,""Front"",IF('C4'!R[-25]C24=2,""Full"",""None"")))"
Range("G38").Select
ActiveSheet.Previous.Select
ActiveSheet.Next.Select
Selection.Copy
Range("J38").Select
ActiveSheet.Paste
Range("M38").Select
ActiveSheet.Paste
Range("P38").Select
ActiveSheet.Paste
Range("S38").Select
ActiveSheet.Paste
Range("V38").Select
ActiveSheet.Paste
Range("Y38").Select
ActiveSheet.Next.Select
Range("G38").Select
Application.CutCopyMode = False
ActiveCell.FormulaR1C1 = _
"=IF(R16C="""","""",IF('C5'!R[-25]C24=1,""Front"",IF('C5'!R[-25]C24=2,""Full"",""None"")))"
Range("G38").Select
Selection.Copy
Range("J38").Select
ActiveSheet.Paste
Range("M38").Select
ActiveSheet.Paste
Range("P38").Select
ActiveSheet.Paste
Range("S38").Select
ActiveSheet.Paste
Range("V38").Select
ActiveSheet.Paste
Range("F38").Select
ActiveSheet.Next.Select
Range("G38").Select
Application.CutCopyMode = False
ActiveCell.FormulaR1C1 = _
"=IF(R16C="""","""",IF('C6'!R[-25]C24=1,""Front"",IF('C6'!R[-25]C24=2,""Full"",""None"")))"
Range("G38").Select
Selection.Copy
Range("J38").Select
ActiveSheet.Paste
Range("M38").Select
ActiveSheet.Paste
Range("P38").Select
ActiveSheet.Paste
Range("S38").Select
ActiveSheet.Paste
Range("V38").Select
ActiveSheet.Paste
Range("A38").Select
ActiveSheet.Next.Select
Range("G38").Select
Application.CutCopyMode = False
ActiveCell.FormulaR1C1 = _
"=IF(R16C="""","""",IF('C7'!R[-25]C24=1,""Front"",IF('C7'!R[-25]C24=2,""Full"",""None"")))"
Range("G38").Select
Selection.Copy
Range("J38").Select
ActiveSheet.Paste
Range("M38").Select
ActiveSheet.Paste
Range("P38").Select
ActiveSheet.Paste
Range("S38").Select
ActiveSheet.Paste
Range("V38").Select
ActiveSheet.Paste
Range("G38").Select
ActiveSheet.Previous.Select
Range("G38").Select
ActiveSheet.Next.Select
ActiveSheet.Next.Select
Range("G38").Select
Application.CutCopyMode = False
ActiveCell.FormulaR1C1 = _
"=IF(R16C="""","""",IF('C8'!R[-25]C24=1,""Front"",IF('C8'!R[-25]C24=2,""Full"",""None"")))"
Range("G38").Select
Selection.Copy
Range("J38").Select
ActiveSheet.Paste
Range("M38").Select
ActiveSheet.Paste
Range("P38").Select
ActiveSheet.Paste
Range("S38").Select
ActiveSheet.Paste
Range("V38").Select
ActiveSheet.Paste
Range("A38").Select
ActiveWindow.SmallScroll Down:=-15
Sheets("cma1").Select
Range("H38").Select
Application.CutCopyMode = False
Selection.Copy
Sheets(Array("cma1", "cma2", "cma3", "cma4", "cma5", "cma6", "cma7", "cma8")).Select
Sheets("cma1").Activate
ActiveSheet.Paste
Range("K38").Select
ActiveSheet.Paste
Range("N38").Select
ActiveSheet.Paste
Range("Q38").Select
ActiveSheet.Paste
Range("T38").Select
ActiveSheet.Paste
Range("W38").Select
ActiveSheet.Paste
Sheets(Array("cma2", "cma3", "cma4", "cma5", "cma6", "cma7", "cma8")).Select
Sheets("cma2").Activate
Range("A38").Select
Application.CutCopyMode = False
ActiveCell.FormulaR1C1 = "Landscaping"
Range("A39").Select
Sheets("cma2").Select
Range("H38").Select
ActiveSheet.Next.Select
Range("H38").Select
ActiveSheet.Previous.Select
ActiveSheet.Previous.Select
Range("H38").Select
Selection.Copy
Range("I38").Select
Application.CutCopyMode = False
Sheets(Array("cma1", "cma2", "cma3", "cma4", "cma5", "cma6", "cma7", "cma8")).Select
Sheets("cma1").Activate
Range("H38").Select
Selection.Copy
Range("K38").Select
ActiveSheet.Paste
Range("N38").Select
ActiveSheet.Paste
Range("Q38").Select
ActiveSheet.Paste
Range("T38").Select
ActiveSheet.Paste
Range("W38").Select
ActiveSheet.Paste
Range("G40").Select
Application.CutCopyMode = False
Sheets("cma2").Select
Range("G39").Select
End Sub

### Excel Facts

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".
Try:
Range("F61").Formula = "=IF(F16="""","""",(-PV(assessintrate,Adjustments!\$C\$45,'KB Data'!\$L17*(AVERAGE('KB Data'!\$P41:\$AA41)*assessdiv))*Adjustments!\$C\$46))"
Range("F38").Formula = "=IF(F\$16="""","""",IF('KB Data'!\$X13=1,""Front"",IF('KB Data'!\$X13=2,""Full"",""None"")))"

The formula worked for F61 however I receive an error "run-time error application-defined or object defined error" when I used a different formula for G61. Range("G61").Formula....... Any ideas why?

Range("A61").Select
ActiveCell.FormulaR1C1 = "Tax Rate"
Range("F61").Formula = "=IF(F16="""","""",(-PV(assessintrate,Adjustments!\$C\$45,'KB Data'!\$L17*(AVERAGE('KB Data'!\$P41:\$AA41)*assessdiv))*Adjustments!\$C\$46))"
Range("F61").Select
Selection.Copy
Range("I61").Select
ActiveSheet.Paste
Range("L61").Select
ActiveSheet.Paste
Range("O61").Select
ActiveSheet.Paste
Range("R61").Select
ActiveSheet.Paste
Range("U61").Select
ActiveSheet.Paste
Range("A61").Select
Application.CutCopyMode = False
Range("D61").Select
ActiveCell.FormulaR1C1 = "varies"
Range("G61").Select
Range("G61").Formula = "=IF(G16="","",IF('C1'!\$L\$17="",(-PV(assessintrate,Adjustments!\$C\$45,'KB Data'!\$L\$17*(AVERAGE('C1'!\$P41:\$AA41)*assessdiv))),(-PV(assessintrate,Adjustments!\$C\$45,'C1'!\$L17*(AVERAGE('C1'!\$P41:\$AA41)*assessdiv))))*Adjustments!\$C\$46)"
Range("G61").Select
Selection.Copy
Range("J61").Select
ActiveSheet.Paste
Range("J61").Select
ActiveSheet.Paste

Range("G61").Formula = "=IF(G16="""","""",IF('C1'!\$L\$17="""",(-PV(assessintrate,Adjustments!\$C\$45,'KB Data'!\$L\$17*(AVERAGE('C1'!\$P41:\$AA41)*assessdiv))),(-PV(assessintrate,Adjustments!\$C\$45,'C1'!\$L17*(AVERAGE('C1'!\$P41:\$AA41)*assessdiv))))*Adjustments!\$C\$46)"

All the Red extra apostrophes are required.

Replies
2
Views
265
Replies
2
Views
459
Replies
19
Views
1K
Replies
3
Views
340
Replies
2
Views
978

Threads
1,203,600
Messages
6,056,206
Members
444,850
Latest member
dancasta7

### 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

### 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