Skip to content

Instantly share code, notes, and snippets.

@kencoba
Created August 23, 2015 11:40
Show Gist options
  • Save kencoba/da6d08ecb45fac6de78d to your computer and use it in GitHub Desktop.
Save kencoba/da6d08ecb45fac6de78d to your computer and use it in GitHub Desktop.
特定条件の行の,データが入力されているセルのみ強調表示する
Private Const 強調色 = 4
Private Const 検索開始列 = 2
Private Const 検索最終列 = 6
Private Const 検索開始行 = 2
Private Const 検索最終行 = 6
Public Sub 強調表示_1件のみ()
Dim r As Range: Set r = Range(Cells(検索開始行, 検索開始列), Cells(検索最終行, 検索開始列))
Dim c As Range
For Each c In r
Dim s As Range: Set s = Range(Cells(c.Row, c.Column), Cells(c.Row, 検索最終列))
If WorksheetFunction.CountA(s) = 1 Then
Dim d As Range
For Each d In s
If d <> "" Then
d.Interior.ColorIndex = 強調色
End If
Next d
End If
Next c
End Sub
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment