Sub check()
Dim str As String
str = Format(Now(), "Short Date") '今日の日付をstringで保存
Range("C1").End(xlDown).Select
While ActiveCell = str '今日の日付であれば繰り返す
'やりたい処理
If ActiveCell.Offset(0, 2) = "" Then
ActiveCell.Offset(0, -2).Interior.ColorIndex = 1
End If
If ActiveCell.Offset(0, 3) = "" Then
ActiveCell.Offset(0, -2).Interior.ColorIndex = 9
End If
If ActiveCell.Offset(0, 4) = "" Then
ActiveCell.Offset(0, -2).Interior.ColorIndex = 3
End If
If ActiveCell.Offset(0, 5) = "" Then
ActiveCell.Offset(0, -2).Interior.ColorIndex = 4
End If
If ActiveCell.Offset(0, 6) = "" Then
ActiveCell.Offset(0, -2).Interior.ColorIndex = 5
End If
If ActiveCell.Offset(0, 7) = "" Then
ActiveCell.Offset(0, -2).Interior.ColorIndex = 6
End If
If ActiveCell.Offset(0, 11) = "" Then
ActiveCell.Offset(0, -2).Interior.ColorIndex = 7
End If
If ActiveCell.Offset(0, 13) = "" Then
ActiveCell.Offset(0, -2).Interior.ColorIndex = 8
End If
'やりたい処理終了
'一つ上に移動してセレクト
ActiveCell.Offset(-1, 0).Select
Wend
End Sub
More than 3 years have passed since last update.
VBA エクセル 今日の日付分のみ、入力最終行から上に検索してセルに色付け
Last updated at Posted at 2021-06-16
Register as a new user and use Qiita more conveniently
- You get articles that match your needs
- You can efficiently read back useful information
- You can use dark theme