I have a VB script that I did not write and I confess to know very little about VB.
I am trying to amend the following script with the one below but Ikeep getting a 1004 run time error
If PensionRowNum <> 0 Then
Range("J" & PensionRowNum).Select
ActiveCell.FormulaR1C1 = "=IF(ISERROR(SUM(Permanent_Staff!AO16:AO500)/V" & BasicPayRowNum & "*J" & BasicPayRowNum & ")," & NullString & ",(SUM(Permanent_Staff!AO16:AO500)/V" & BasicPayRowNum & "*J" & BasicPayRowNum & "))"
ActiveCell.Replace What:="'", Replacement:="", LookAt:=xlPart, SearchOrder _
:=xlByRows, MatchCase:=False
Range("K" & PensionRowNum).Select
My attempted change as follows(first row only included)
If PensionRowNum <> 0 Then
Range("J" & PensionRowNum).Select
ActiveCell.FormulaR1C1 = "=IF(ISERROR(SUMIF(Permanent_Staff!D16500,""FS"",Permanent_Staff!AO16:AO500)/V5*J5)," & NullString & ",SUMIF(Permanent_Staff!D16500,""FS"",Permanent_Staff!AO16:AO500)/V5*J5))"
ActiveCell.Replace What:="'", Replacement:="", LookAt:=xlPart, SearchOrder _
:=xlByRows, MatchCase:=False
I am trying to amend the following script with the one below but Ikeep getting a 1004 run time error
If PensionRowNum <> 0 Then
Range("J" & PensionRowNum).Select
ActiveCell.FormulaR1C1 = "=IF(ISERROR(SUM(Permanent_Staff!AO16:AO500)/V" & BasicPayRowNum & "*J" & BasicPayRowNum & ")," & NullString & ",(SUM(Permanent_Staff!AO16:AO500)/V" & BasicPayRowNum & "*J" & BasicPayRowNum & "))"
ActiveCell.Replace What:="'", Replacement:="", LookAt:=xlPart, SearchOrder _
:=xlByRows, MatchCase:=False
Range("K" & PensionRowNum).Select
My attempted change as follows(first row only included)
If PensionRowNum <> 0 Then
Range("J" & PensionRowNum).Select
ActiveCell.FormulaR1C1 = "=IF(ISERROR(SUMIF(Permanent_Staff!D16500,""FS"",Permanent_Staff!AO16:AO500)/V5*J5)," & NullString & ",SUMIF(Permanent_Staff!D16500,""FS"",Permanent_Staff!AO16:AO500)/V5*J5))"
ActiveCell.Replace What:="'", Replacement:="", LookAt:=xlPart, SearchOrder _
:=xlByRows, MatchCase:=False