私は、ユーザー入力の日付と現在の日付を比較し、適切な色で背景を塗りつぶすVBAコードを持っています。すべて正常に動作します。vbaはセルが空でないかどうかをチェックし、行全体を色付けする方法を秀でていますか?
今は選択された行のカラムFにおけるセルiがグレー色に着色カラムD、E、Fに必要空でないかどうかをチェックするシステムを作る必要があります。
コード:
Private Sub CommandButton1_Click()
Dim i As Integer
For i = Range("C5000").End(xlUp).Row To 2 Step -1 'Range upto 5000, chnge this as per your requirment'
If IsEmpty(Cells(i, 3)) Then
Cells(i, 3).Interior.Color = xlNone
ElseIf (VBA.CDate(Cells(i, 3)) - VBA.Date()) < 0 Then
Cells(i, 3).Interior.Color = vbGreen
ElseIf (VBA.CDate(Cells(i, 3)) - VBA.Date()) = 0 Then
Cells(i, 3).Interior.Color = vbYellow
ElseIf (VBA.CDate(Cells(i, 3)) - VBA.Date()) >= 1 And (VBA.CDate(Cells(i, 3)) - VBA.Date()) <= 4 Then
Cells(i, 3).Interior.Color = vbRed
ElseIf (VBA.CDate(Cells(i, 3)) - VBA.Date()) >= 5 And (VBA.CDate(Cells(i, 3)) - VBA.Date()) <= 10 Then
Cells(i, 3).Interior.Color = vbCyan
Else
Cells(i, 3).Interior.ColorIndex = xlNone
End If
Next
End Sub
私はあなたが、関連のcriteriasでTrim(Range("F" & i).Value) <> ""
場合もチェックする必要があります任意の助け
使用条件付き書式 – Rosetta
@Rosettaには、私は私のコード –
'かの細胞(I、6)<> "" その後、細胞(I、3).entirerow.interior.color = vbRedでそれを追加する必要がありません'...これはあなたの問題を解決しますか? – Rosetta