|
▼piropiro さん:
本当の原因はわかりませんが、そちらで試してもらった確認3,確認4,確認5 の結果から
以下のコードで、正しく【39行のみ】削除されるはずです。
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
Else
Set r = Union(r, c)
End If
Set c = a.FindNext(c)
Loop While c.Address <> f.Address
r.EntireRow.Delete
End Sub
|
|