Private Sub Worksheet_Calculate()
Dim cell As Range
Set cell = Range("E9")
If IsNumeric(cell) Then
If cell.Value < 0 Then
ActiveSheet.Shapes("Rectangle 2").Fill.ForeColor.RGB = vbRed
Else
ActiveSheet.Shapes("Rectangle 2").Fill.ForeColor.RGB = vbGreen
End If
End If
End Sub
嗨,我如何扩展此代码以使用多种形状?我试图将所有内容从Set cell复制到End if并更改Set cell值和形状,但这不起作用。