This formula was written while recording a Macro. Works perfectly fine in a cell , but when trying to run from VBE ,its throwing a runtime error '1004'. Any help appreciated .... Thanks in Advance
Sub Macro7()
'
' Macro7 Macro
'
'
ActiveCell.FormulaR1C1 = _
"=IF(ISNUMBER(SEARCH("".PRE."",RC[-16])),""Preliminaries"",IF(ISNUMBER(SEARCH("".AUT."",RC[-16])),""Authority Approvals"",IF(ISNUMBER(SEARCH(""MMS"",RC[-16])),""Material& MStatementSubmittals"",IF(ISNUMBER(SEARCH(""SDS"",RC[-16])),""Shop Drawing Submittals"",IF(ISNUMBER(SEARCH("".MMA."",RC[-16])),""Materials& MStatement Approvals"",IF(ISNUMBER(SEARCH("".SDA."",RC[-16" & _
"op Drawing Approvals"",IF(ISNUMBER(SEARCH("".BDS."",RC[-16])),""Builders drawings submittals"",IF(ISNUMBER(SEARCH("".CDS."",RC[-16])),""Coordination drawing submittals"",IF(ISNUMBER(SEARCH("".STR."",RC[-16])),""Structural Concreting works"",IF(ISNUMBER(SEARCH("".MET."",RC[-16])),""Metal Works"",IF(ISNUMBER(SEARCH("".MAD."",RC[-16])),""Material Required on Site"",IF(" & _
"ER(SEARCH("".FIN."",RC[-16])),ISNUMBER(SEARCH("".PMA."",RC[-16])),ISNUMBER(SEARCH("".FLC."",RC[-16]))),""Finishes"",IF(ISNUMBER(SEARCH("".DAW."",RC[-16])),""Doors and windows"",IF(ISNUMBER(SEARCH("".LFT."",RC[-16])),""Lift & Elevators"",IF(ISNUMBER(SEARCH("".ELE."",RC[-16])),""Electrical System"",IF(ISNUMBER(SEARCH("".MEP."",RC[-16])),""Plumbing&firefighting"",IF(IS" & _
"ARCH("".F&F."",RC[-16])),""Firefighting"",IF(ISNUMBER(SEARCH("".HAC."",RC[-16])),""HVAC"",IF(ISNUMBER(SEARCH("".WP"",RC[-16])),""Waterproofing"",IF(ISNUMBER(SEARCH("".LPG."",RC[-16])),""LPG"",""""))))))))))))))))))))"
Range("Q3").Select
End Sub
Sub Macro7()
'
' Macro7 Macro
'
'
ActiveCell.FormulaR1C1 = _
"=IF(ISNUMBER(SEARCH("".PRE."",RC[-16])),""Preliminaries"",IF(ISNUMBER(SEARCH("".AUT."",RC[-16])),""Authority Approvals"",IF(ISNUMBER(SEARCH(""MMS"",RC[-16])),""Material& MStatementSubmittals"",IF(ISNUMBER(SEARCH(""SDS"",RC[-16])),""Shop Drawing Submittals"",IF(ISNUMBER(SEARCH("".MMA."",RC[-16])),""Materials& MStatement Approvals"",IF(ISNUMBER(SEARCH("".SDA."",RC[-16" & _
"op Drawing Approvals"",IF(ISNUMBER(SEARCH("".BDS."",RC[-16])),""Builders drawings submittals"",IF(ISNUMBER(SEARCH("".CDS."",RC[-16])),""Coordination drawing submittals"",IF(ISNUMBER(SEARCH("".STR."",RC[-16])),""Structural Concreting works"",IF(ISNUMBER(SEARCH("".MET."",RC[-16])),""Metal Works"",IF(ISNUMBER(SEARCH("".MAD."",RC[-16])),""Material Required on Site"",IF(" & _
"ER(SEARCH("".FIN."",RC[-16])),ISNUMBER(SEARCH("".PMA."",RC[-16])),ISNUMBER(SEARCH("".FLC."",RC[-16]))),""Finishes"",IF(ISNUMBER(SEARCH("".DAW."",RC[-16])),""Doors and windows"",IF(ISNUMBER(SEARCH("".LFT."",RC[-16])),""Lift & Elevators"",IF(ISNUMBER(SEARCH("".ELE."",RC[-16])),""Electrical System"",IF(ISNUMBER(SEARCH("".MEP."",RC[-16])),""Plumbing&firefighting"",IF(IS" & _
"ARCH("".F&F."",RC[-16])),""Firefighting"",IF(ISNUMBER(SEARCH("".HAC."",RC[-16])),""HVAC"",IF(ISNUMBER(SEARCH("".WP"",RC[-16])),""Waterproofing"",IF(ISNUMBER(SEARCH("".LPG."",RC[-16])),""LPG"",""""))))))))))))))))))))"
Range("Q3").Select
End Sub