Macro to exclude row if cell has a partial match.

bailsmb

New Member
Joined
Oct 13, 2015
Messages
8
Hiker95 provided me with a code as noted below. I tweaked it some. What I'm looking for is if Column H contains any portion of the word "Resolve" to exclude that row.

Code:
Sub bailsmb()
' hiker95, 10/13/2015, ME894007
Dim we As Worksheet
Dim c As Range, lr As Long, nr As Long
Application.ScreenUpdating = False
Set we = Sheets("Exceptions")
Columns("A:M").ColumnWidth = 75
Range("A:M").WrapText = True
With Sheets("Third Party")
  lr = .Cells(.Rows.Count, 1).End(xlUp).Row
    For Each c In .Range("H1:H" & lr)
    If c <> "Resolved" And c <> "NA" Then
      nr = we.Cells(we.Rows.Count, "A").End(xlUp).Row + 1
      If nr = 2 And we.Range("A1") = "" Then nr = 1
      we.Range("A" & nr).Resize(, 12).Value = .Range("A" & c.Row).Resize(, 12).Value
      we.Range("l" & nr).Value = .Range("n" & c.Row).Value
    End If
  Next c
End With
With Sheets("Branch Operations")
  lr = .Cells(.Rows.Count, 1).End(xlUp).Row
  For Each c In .Range("H1:H" & lr)
    If c <> "Resolved" And c <> "NA" Then
      nr = we.Cells(we.Rows.Count, "A").End(xlUp).Row + 1
      If nr = 2 And we.Range("A1") = "" Then nr = 1
      we.Range("A" & nr).Resize(, 12).Value = .Range("A" & c.Row).Resize(, 12).Value
    End If
  Next c
End With
With we
  .Columns("A:L").AutoFit
  .Activate
End With
Application.ScreenUpdating = True
End Sub


Right now it's looking for "Resolve" and "NA". I want it to look for any variation of "Resolve" (e.g. "resolved, Resolve:, Resolving) and "NA".

Any help would be appreciated. Thank you.
 
Last edited:

Excel Facts

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.

Forum statistics

Threads
1,223,227
Messages
6,170,848
Members
452,361
Latest member
d3ad3y3

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top