td_excelforum
New Member
- Joined
- Dec 3, 2021
- Messages
- 6
- Office Version
- 365
- Platform
- Windows
I'm trying to delete some row before the occurence of a word ('datum'). In some sheets there are headers in the first row (classic Column1 etc) that I want to delete if they do not contain this word ('datum').
I'm failing in these sheets as headers are not deletable. Any ideas?
I'm failing in these sheets as headers are not deletable. Any ideas?
VBA Code:
Set fRg = Cells.Find(What:="datum", LookAt:=xlWhole)
If Not fRg Is Nothing Then
If fRg.Row <> 1 Then
Range("A1", fRg.Offset(-1)).EntireRow.Delete
Else
End If
Else
End If