I don't really know what I am doing here, but I need to search Column B for 3 different strings. I need it to search for city, state, and zip, and if any of the columns have matching city, state, or zips, then I need that row removed.
I also have it set up to remove a row if there is a 0 at the beginning of a field in column B, but I couldn't get this to work, and actually I now need it for column D.
Here is the code I have thus far:
Sub EOD()
'
' ZIP Macro
'
' Keyboard Shortcut: Ctrl+e
'
Rows("1:3").Select
Selection.Delete Shift:=xlUp
Columns("B:B").Select
Selection.Delete Shift:=xlToLeft
Columns("D:D").Select
Selection.Delete Shift:=xlToLeft
Columns("E:X").Select
Selection.Delete Shift:=xlToLeft
Range("A1").Select
'37546
Sheets("37546").Select
Rows("1:3").Select
Selection.Delete Shift:=xlUp
Columns("B:B").Select
Selection.Delete Shift:=xlToLeft
Columns("D:D").Select
Selection.Delete Shift:=xlToLeft
Columns("E:X").Select
Selection.Delete Shift:=xlToLeft
Range("A1").Select
'39201
Sheets("39201").Select
Rows("1:3").Select
Selection.Delete Shift:=xlUp
Columns("B:B").Select
Selection.Delete Shift:=xlToLeft
Columns("D:D").Select
Selection.Delete Shift:=xlToLeft
Columns("E:X").Select
Selection.Delete Shift:=xlToLeft
Range("A1").Select
'36241
Sheets("36241").Select
Rows("1:3").Select
Selection.Delete Shift:=xlUp
Columns("B:B").Select
Selection.Delete Shift:=xlToLeft
Columns("D:D").Select
Selection.Delete Shift:=xlToLeft
Columns("E:X").Select
Selection.Delete Shift:=xlToLeft
Range("A1").Select
'Delete row containing City State and Zip
Dim r As Integer
Dim cityStateZip
cityStateZip = InputBox("Input the city, state, or zip code from " & vbNewLine & _
"column C for which you want rows removed.")
For r = 1 To GetLastRow("37546", "B")
If Left(CStr(Cells(r, 6).Value), 1) = "0" Or (Len(Orlando, Fl, 32803) > 0 And InStr(1, Cells(r, 3).Value, cityStateZip) > 0) Then
Rows(r).EntireRow.Delete
r = r - 1
End If
Next
End Sub
Bookmarks