|
▼nonoka さん:
判定の優先度がいまいちわかりませんが、K3とN〜AAの比較を第一優先としたコードです。
Sub Sample()
Dim c As Range
Dim a As Variant
Dim r As Range
Dim bDt As Double
Application.ScreenUpdating = False
bDt = Range("K3").Value2
For Each c In Range("K10", Range("K" & Rows.Count).End(xlUp))
With c.EntireRow
.Range("L1").ClearContents
If IsDate(c.Value) Then
Set r = .Range("N1:AA1")
a = Application.Match(bDt, r, 0)
If IsNumeric(a) Then
.Range("L1").Value = Cells(9, a + 13).Value
Else
a = Application.Match(.Range("K1").Value2, r, 0)
If IsNumeric(a) Then
.Range("L1").Value = Cells(9, a + 13).Value
Else
If .Range("K1").Value2 < bDt Then
.Range("L1").Value = "未投入"
Else
If .Range("M1").Value2 < bDt Then .Range("L1").Value = "完了"
End If
End If
End If
End If
End With
Next
Application.ScreenUpdating = True
MsgBox "処理完了"
End Sub
|
|