I want to write a code that deletes the rows that contain slash in a specific column. For example if in column H a slash appears in row 7, delete row 7. I was able to delete in cases where there were blank cells and in cases where there were words, but something with the slash is incorrect.
Rng.AutoFilter field:=8, Criteria1:="/"
Rng.Offset(1,0).SpecialCells(xlCellTypeVisible).EntireRow.Delete
ActiveSheet.AutoFilterMode = False
I tried to use instead of "/" also "//" and "@/" but it didn't help.
I want to make an if statement so that if there is a number in a cell that contains numbers and "-", the cell value will be copied to another place. I could not find a way to incorporate the hyphen within the conditional sentence. An example: 12345-6789.
thank you :)
CodePudding user response:
This worked for me:
Sub tester()
With [A1].CurrentRegion
.AutoFilter field:=8, Criteria1:="=*/*"
On Error Resume Next 'in case no matches
.Offset(1, 0).SpecialCells(xlCellTypeVisible).EntireRow.Delete
On Error GoTo 0
End With
ActiveSheet.AutoFilterMode = False
End Sub