Ottsel
Board Regular
- Joined
- Jun 4, 2022
- Messages
- 167
- Office Version
- 365
- Platform
- Windows
Fairly new still to VBA. I've tried to put this together, but keep running into issues. Anyone see what I'm doing wrong?
In short, whatever is in column E or column 5, if it doesn't end in ".xls" or ".xlsm" then i want to delete the row.
Tips, tricks or pointers would be appreciated! Thanks in advance!
In short, whatever is in column E or column 5, if it doesn't end in ".xls" or ".xlsm" then i want to delete the row.
VBA Code:
Sub test123()
Dim y As Long
Dim cellValue As String
For y = 2 To 257
cellValue = Cells(y, 5).Value
If cellValue = Right(cellValue, 4).Value = ".xls" Or cellValue = Right(cellValue, 5).Value = ".xlsm" Then
Rows(y).EntireRow.Delete
End If
Next y
End Sub
Tips, tricks or pointers would be appreciated! Thanks in advance!