Reputation: 45
Confused about a Run-Time error I am receiving. I'm building a tool that changes formulas by state. No problem building the Excel If functions, but when I clear the below I run into an issue at Range("C13")...
Sub clearICRs()
Range("B2").Value = "(Select State)"
Range("C4:C8,C11,C18,C20,C24").Value = "0"
Range("C13").Value = "=IF($B$2=""Arkansas"",'Taxes & Fees'!$F$29,IF($B$2=""Connecticut"",IF($C$11<=50000,0.0635,0.07),IF($E21=TRUE,$F21,""Input Tax %""))"
Range("C15").Value = "=IF($B$2=""California"",""Input CVR"",IF($E15=TRUE,$F15,""Input Fees""))"
Rows("16:17").Select
Selection.EntireRow.Hidden = True
Range("C21").Value = "=IF($B$2=""Connecticut"",IF($C$11<=50000,0.0635,0.07),IF($E21=TRUE,$F21,""Input Tax %""))"
Range("C23").Value = "=IF($B$2=""Arkansas"",'Taxes & Fees'!$F$29,IF($E23=TRUE,$F23,""Input Fees""))"
End Sub
However, if IF($B$2=""Arkansas"",'Taxes & Fees'!$F$29, is removed from Range("C13")... the code works. What I need help understanding is why I run into an error on C13 but not on C23?
Thanks
Upvotes: 1
Views: 132
Reputation: 35557
Add another ) to the end of the formula
Range("C13").Value = "=IF($B$2="Arkansas",'Taxes & Fees'!$F$29,IF($B$2="Connecticut",IF($C$11<=50000,0.0635,0.07),IF($E21=TRUE,$F21,"Input Tax %")))"
Upvotes: 1