对我收到的运行时错误感到困惑。我正在构建一个按州更改公式的工具。构建Excel没问题如果有功能,但是当我清除下面的内容时我遇到了范围(“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
但是,如果 IF($ B $ 2 =“”Arkansas“”,“税费和费用”!$ F $ 29,已从范围(“C13”)中删除.. 代码有效。我需要帮助理解的是为什么我在 C13 上遇到错误而在 C23 上遇到错误?
由于
答案 0 :(得分:1)
添加另一个)到公式的末尾
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 %")))"