0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

VBA エクセル 今日の日付分のみ、入力最終行から上に検索してセルに色付け

Last updated at Posted at 2021-06-16
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

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?