Excel这个条件格式该怎样设置?

来源:百度知道 编辑:UC知道 时间:2024/05/15 03:26:27
要求:当B2<>0、B3<>0、B4=[C5]>2000时,D2为红色字体。
问题1:请问D2单元格的条件格式的公式怎样表达?
问题2:当满足此条件时,希望弹出信息窗口,并显示“数据有误”,请问在VBA编辑器中代码应怎样写?
要求中应该是B4=[C5] / 2000时

=AND(B2>0,B3>0,B4=C5/2000)

Sub AAA()
If Cells(2, 2).Value > 0 And Cells(3, 2).Value > 0 And Cells(4, 2).Value = Cells(5, 3).Value / 2000 Then
Cells(2, 4).Font.ColorIndex = 3
MsgBox ("数据有误")
Else
MsgBox ("无发现错误")
End If
End Sub