Livin404
Well-known Member
- Joined
- Jan 7, 2019
- Messages
- 743
- Office Version
- 365
- 2019
- Platform
- Windows
Greetings, I'm hoping to have a VBA that will search in Column A for "NO DEPARTURES". In instances where the word is found and data is in the row immediately below, I would like that row deleted and all the cells in the row shifted up. If there is no data immediately below "NO DEPARTURES", then nothing needs to happen. There is no message box required let me know what action is was accomplished, for it will be apparent by the final product. In the image below row 8 would be deleted and rows below shifted up. Since the row below Row 13 is empty nothing needs to happen.
I know if I wanted just to remove "NO DEPARTURES" I can use the VBA below, but I need to work in the rules described above. Thank you,
I know if I wanted just to remove "NO DEPARTURES" I can use the VBA below, but I need to work in the rules described above. Thank you,
VBA Code:
Sub Rowdel()
Dim i As Integer
For i = Cells(Rows.Count, 1).End(xlUp).Row To 1 Step -1
If Cells(i, 1) = "NO DEPARTURES" Then Cells(i, 1).EntireRow.Delete
Next i
End Sub
Last edited: