また、次のような式を使用することもできます。より多くのロジックと色を扱えるように関数を変更することができます。
これは、式が真である場合、行を緑色にします。色はRGBで指定します。あなたの答えのための
=ColorRowIF(A1=B1, 1, 181, 0)
またはあなたの場合は
=ColorRowIF(ISBLANK(B2), 1, 181, 0)
Public Function ColorRowIF(Condition As Boolean, r As Integer, g As Integer, b As Integer) As String
Dim row As Integer
row = Application.Caller.row
If Condition = True Then
ActiveSheet.Evaluate "ColorRow(" & row & ", " & r & ", " & g & ", " & b & ")"
Else
'ws.Rows(r).Interior.Color = vbRed
End If
ColorRowIF = Condition
End Function
Public Sub ColorRow(row As Integer, r As Integer, g As Integer, b As Integer)
Dim ws As Worksheet
Set ws = ActiveSheet
ws.Rows(row).Interior.Color = RGB(r, g, b)
End Sub
Function IsDate(CellDate As Date) As Boolean
If CellDate >= 1 And CellDate <= #12/31/2199# Then
' 1 is equal to January 1, 1900
IsDate = True
Else
IsDate = False
End If
End Function
おかげで、私はVBAに新たなんだと、これは素晴らしい作品にそれが私の頭をやっています。 – Hosey93
うれしい私は助けることができます。質問に回答したことを明記してください。もし 'IsEmpty'のようなものが必要ならば、' objCell.Value> 0'が本当に必要なものを実行するかどうかを検討してください。 –