View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.misc
ManhattanRebel ManhattanRebel is offline
external usenet poster
 
Posts: 85
Default why doesn't this simple macro work in excel 2007?

I wrote this simple macro to just go through column B and delete rows that
don't have an email in them. It won't even compile. It tells me error
"Next without for".



Sub FindEmail()
'try to separate email addresses and add a comma at the end of them
FinalRow = Cells(65536, 2).End(xlUp).Row

For i = 1 To FinalRow
Cells(i, 2).Select
If Isblank.Cells(i, 2) Then
Range(i, 2).Select.Delete
Else
If Cells(i, 2).Value < "@" Then
Range(i, 2).Select.Delete
End If
Next i
End Sub