If there is no data there statement

  • Thread starter Thread starter Annette
  • Start date Start date
A

Annette

How can add the if statement to this so that if there are no records with
"/" in them in the sheet, the macro will not stop and want to debug, but
rather bypass and move on to the next step?
 
How can add the if statement to this so that if there are no records with
"/" in them in the sheet, the macro will not stop and want to debug, but
rather bypass and move on to the next step?


Selection.AutoFilter Field:=4, Criteria1:= _
"* / *"

Cells.Select
Selection.Copy
Sheets("Sheet2").Select
ActiveSheet.Paste

Range("A1").Select
lastrow = ActiveSheet.Cells(Rows.Count, "a").End(xlUp).Row
For RowNdx = lastrow To 1 Step -1
If InStr(Cells(RowNdx, "A").Value, "Office") Then
Rows(RowNdx).Delete
End If
Next RowNdx
 
Hi Annette
it would be helpful if you post your macro / the if statement.
Otherwise answering your question is a little bit complicated :-)
 
I put the code out there right before your message appeared! (I goofed and
sent before I was ready)
 
Hi Annette
try
On Error Resume Next
Selection.AutoFilter Field:=4, Criteria1:="* / *"
On Error GoTo 0
 
Back
Top