**已关闭。**此问题为not reproducible or was caused by typos。当前不接受答案。
这个问题是由一个错字或一个无法再复制的问题引起的。虽然类似的问题可能是on-topic在这里,但这个问题的解决方式不太可能帮助未来的读者。
7天前关闭
Improve this question
我尝试循环通过几个命名单元格引用。代码的目标是1.将一半单元格的值粘贴到当前存在公式的单元格本身,2.将公式添加到另一半命名单元格。然后我将创建由单选按钮控制的反向,但这不是这段代码的一部分。我一直得到一个应用程序定义或对象定义的错误。我做错了什么?
Sub OptionTotal_Click()
Dim total As String
Dim psf As String
Dim formula As String
Dim opexArray(19) As String
opexArray(0) = "base_rent_"
opexArray(1) = "passthru_ret_"
opexArray(2) = "passthru_opex_"
opexArray(3) = "passthru_util_"
opexArray(4) = "passthru_oth_"
opexArray(5) = "amort_"
opexArray(6) = "other_rent_"
opexArray(7) = "depreciation_"
opexArray(8) = "ret_"
opexArray(9) = "utilities_"
opexArray(10) = "opm_"
opexArray(11) = "repairs_"
opexArray(12) = "project_exp_"
opexArray(13) = "prof_fees_"
opexArray(14) = "sublet_inc_"
opexArray(15) = "reserves_"
opexArray(16) = "other_exp_"
opexArray(17) = "gains_losses_"
opexArray(18) = "allocations_"
opexArray(19) = "cost_of_funds_"
Dim i As Integer
For i = LBound(opexArray) To UBound(opexArray)
total = opexArray(i) & "total"
psf = opexArray(i) & "psf"
formula = "=IFERROR(" & psf & "total/RSF,0)"
ActiveSheet.Range(total).Value = ActiveSheet.Range(total).Value
ActiveSheet.Range(psf).fomula = formula
Next i
End Sub
1条答案
按热度按时间utugiqy61#
这似乎工作。感谢所有的帮助。它确实运行得很慢,虽然。任何原因或方法来加快它?