A small issue came up. I just modified the Case terms to find text of my choice.
Now when i am running the macro, it is showing "Compile error: Invalid or unqualified reference"
Any idea what the problem could be?Below is how i edited your code:
Sub DeletePublicationType()
Dim lngCounter As Long
Dim lngLastRow As Long
Dim rngFound As Range
Const cstrSEARCH As String = "Publication Type"
Sheets("Raw Data").Select
Set rngFound = .Rows("1:1").Find(what:=cstrSEARCH, _
LookIn:=xlValues, lookat:=xlWhole, searchorder:=xlByColumns)
If Not rngFound Is Nothing Then
lngLastRow = .Cells(Rows.Count, rngFound.Column).End(xlUp).Row
For lngCounter = lngLastRow To 2 Step -1
Select Case (.Cells(lngCounter, rngFound.Column).Value)
Case "Country Business Guide", "Country HR Web Guide", "Country Guide", "Country Snapshot", "Business Guide"
Rows(lngCounter).Delete
Case Else
'keep record
End Select
Next lngCounter
End If
End With
Set rngFound = Nothing
End Sub
Bookmarks