[英]Value less than 0 red greater than 0 is green
我寫了這個公式來找到一個名為“CV_=CVCAL”的單元格,並從 threre 偏移到另一個單元格。 如果偏移單元格的值小於0,則確定字體顏色為紅色,如果大於0,則字體顏色為綠色。 但是我得到一個語法和編譯錯誤。 我不確定為什么。 任何幫助,將不勝感激。
If Cells(X, 3).Value = "CV_=CVCAL" Then
Cells(X, 3).Offset(2, 3).Value > 0 Then
Cells(X, 3).Offset(2, 3).Font.Color = RGB(0, 176, 80)
End If
If Cells(X, 3).Value = "CV_=CVCAL" Then
Cells(X, 3).Offset(2, 3).Value < 0 Then
Cells(X, 3).Offset(2, 3).Font.Color = RGB(255, 0, 0)
End If
那這個呢? (我剛剛完成了 if 子句):
If Cells(X, 3).Value = "CV_=CVCAL" Then
If Cells(X, 3).Offset(2, 3).Value > 0 Then
Cells(X, 3).Offset(2, 3).Font.Color = RGB(0, 176, 80)
End If
If Cells(X, 3).Offset(2, 3).Value < 0 Then
Cells(X, 3).Offset(2, 3).Font.Color = RGB(255, 0, 0)
End If
End If
只是一個問題:當提到的值等於零時會發生什么?
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.