我正在编写一个循环遍历列的代码,并为单元格值为0的每一行的求解器模型添加约束。
到目前为止,我已经尝试了这个并且它不起作用。
For Each cell In Range("B11:B193").Cells
If cell.Value = 0 Then
SolverAdd CellRef:=(Cells.Address), Relation:=2, FormulaText:="0"
End If
Next
答案 0 :(得分:0)
尝试更改此内容:
SolverAdd CellRef:=(Cells.Address), Relation:=2, FormulaText:="0"
对此:
SolverAdd CellRef:=(cell.Address), Relation:=2, FormulaText:="0"
更新:
您希望因For
行
尝试更新以下内容:
For Each Cell In Range("B11:B193")
If Cell.Value = 0 Then
SolverAdd CellRef:=(Cell.Address), Relation:=2, FormulaText:="0"
End If
Next