I can get my macro to work until I add some error handling:
This works:
Sub BudgetFormula()
'
' BudgetFormula Macro
'
'
Worksheets("WIP").Select
Range("J2").Formula = "=(1-SUM(VLOOKUP(E2,'Set Up'!$C$17:$D$26,2)))*G2"
Range("J2").Select
Selection.Copy
Range("J3:J999").Select
ActiveSheet.Paste
Application.CutCopyMode = False
Range("A2").Select
End Sub
But this does NOT:
Sub BudgetFormula()
'
' BudgetFormula Macro
'
'
Worksheets("WIP").Select
Range("J2").Formula = "=IF(ISERROR((1-SUM(VLOOKUP(E2,'Set Up'!$C$17:$D$26,2)))*G2),"",(1-SUM(VLOOKUP(E2,'Set Up'!$C$17:$D$26,2)))*G2)"
Range("J2").Select
Selection.Copy
Range("J3:J999").Select
ActiveSheet.Paste
Application.CutCopyMode = False
Range("A2").Select
End Sub
Can someone please tell me how to correct?
This works:
Sub BudgetFormula()
'
' BudgetFormula Macro
'
'
Worksheets("WIP").Select
Range("J2").Formula = "=(1-SUM(VLOOKUP(E2,'Set Up'!$C$17:$D$26,2)))*G2"
Range("J2").Select
Selection.Copy
Range("J3:J999").Select
ActiveSheet.Paste
Application.CutCopyMode = False
Range("A2").Select
End Sub
But this does NOT:
Sub BudgetFormula()
'
' BudgetFormula Macro
'
'
Worksheets("WIP").Select
Range("J2").Formula = "=IF(ISERROR((1-SUM(VLOOKUP(E2,'Set Up'!$C$17:$D$26,2)))*G2),"",(1-SUM(VLOOKUP(E2,'Set Up'!$C$17:$D$26,2)))*G2)"
Range("J2").Select
Selection.Copy
Range("J3:J999").Select
ActiveSheet.Paste
Application.CutCopyMode = False
Range("A2").Select
End Sub
Can someone please tell me how to correct?