は、このVBAコードを試してみてください。
Sub Delete_Row_If_Not_Whatever()
Dim RowToTest As Long
'Macro deletes entire row if "Whatever" is not found in column "D"
Application.ScreenUpdating = False 'Turn off screen updating. Code runs faster without screen flicker
'Column Count 4 = "D"
For RowToTest = Cells(Rows.Count, 4).End(xlUp).row To 2 Step -1
'Look for "Whatever" save row and delete other rows. Replace "Whatever" with what you want to keep.
'Column Count 4 = "D"
With Cells(RowToTest, 4)
If .Value <> "Whatever" _
Then _
Rows(RowToTest).EntireRow.Delete
End With
Next RowToTest
Application.ScreenUpdating = True 'Turn on screen updating
End Sub
は必ず保存してくださいバックアップを開始する前に。 :)
'Range(" A "&i:" C "&i)' –