| |
▼piropiro さん:
ごめんなさい。ある行に複数NAがあって、その中のどれかの上下にも連続したNAがあるんですね。
コードを少し変更しました。
Sub Test()
Dim a As Range
Dim r As Range
Dim c As Range
Dim f As Range
Dim x As Long
'使用領域の K列から最終列までの列数
x = Range("A1", ActiveSheet.UsedRange).Columns.Count - 10
'判定対象領域
Set a = Range("I4", Range("I" & Rows.Count).End(xlUp)).Offset(, 2).Resize(, x)
Set c = a.Find(What:="NA", LookAt:=xlWhole, LookIn:=xlFormulas)
If c Is Nothing Then
MsgBox "領域に NA はありません"
Exit Sub
End If
Set f = c
Do
If r Is Nothing Then
Set r = c.EntireRow
Else
Set r = Union(r, c.EntireRow)
End If
Set c = a.FindNext(c)
Loop While c.Address <> f.Address
r.Delete
End Sub
|
|