|
こんばんは
カオス・・・
Sub test1()
Dim c As Long
Dim g As Long
Dim r As Range
c = ActiveCell.Column
g = ActiveCell.Row
With WorksheetFunction
On Error Resume Next
For Each r In Range("A" & g & ":A65536") _
.SpecialCells(xlCellTypeConstants)
Select Case True
Case r(1, c) = 1 And .CountA(r(1, c + 1).Resize(, 2)) > 0
Case r(1, c) = 2 And .CountA(r(1, c + 1).Resize(, 2)) = 0
Case Else
r(1, c).Interior.ColorIndex = 3
End Select
Next
End With
End Sub
Sub マクロ1()
Dim c As Long
Dim g As Long
Dim r As Range
c = ActiveCell.Column
g = ActiveCell.Row
With WorksheetFunction
On Error Resume Next
For Each r In Range("A" & g & ":A65536") _
.SpecialCells(xlCellTypeConstants)
Select Case True
Case r(1, c) = 1 And Not IsEmpty(r(1, c + 1))
Case r(1, c) = 2 And IsEmpty(r(1, c + 1))
Case IsEmpty(r(1, c)) And _
(IsEmpty(Cells(r.Row, "Z")) Or _
Cells(r.Row, "Z").Value = 3)
Case Else
r(1, c).Interior.ColorIndex = 3
End Select
Next
End With
End Sub
Sub マクロ2()
Dim c As Long
Dim g As Long
Dim r As Range
c = ActiveCell.Column
g = ActiveCell.Row
With WorksheetFunction
On Error Resume Next
For Each r In Range("A" & g & ":A65536") _
.SpecialCells(xlCellTypeConstants)
Select Case True
Case r(1, c) = 1 And Not IsEmpty(r(1, c + 1)) And _
.CountA(r(1, c + 2).Resize(, 2)) > 0
Case r(1, c) = 2 And .CountA(r(1, c + 1).Resize(, 3)) = 0
Case IsEmpty(r(1, c)) And _
(IsEmpty(Cells(r.Row, "Z")) Or _
Cells(r.Row, "Z").Value = 3)
Case Else
r(1, c).Interior.ColorIndex = 3
End Select
Next
End With
End Sub
|
|