|
こんにちは。
こんな感じでいかがでしょう。
AB列を作業列にしています。
Sub test()
Dim myR As Range
Dim myVal As Variant
Dim myRow As Long
Dim r As Range
With Worksheets("sheet2")
myVal = .Range("A2", .Range("A65536").End(xlUp)).Value
End With
With Worksheets("sheet1")
Set myR = .Range("B5", .Range("B65536").End(xlUp))
myRow = .Range("B65536").End(xlUp).Row
For i = 1 To UBound(myVal, 1)
For Each r In myR
If InStr(r.Value, myVal(i, 1)) > 0 Then
r.Offset(0, 26).Value = 1
End If
Next
Next
With Range("AB5:AB" & myRow)
Application.DisplayAlerts = False
.SpecialCells(xlCellTypeBlanks).EntireRow.Delete
Application.DisplayAlerts = True
.Value = ClearContents
End With
End With
End Sub
|
|