Find/Replace After A5

jonathann3891

Board Regular
Joined
Apr 27, 2015
Messages
109
I have this bit of code that will find and replace text

Code:
   Columns("A").Replace "*section*", "#N/A", xlPart
    Columns("A").Replace "*show*", "#N/A", xlPart
    On Error Resume Next
    Columns("A").SpecialCells(xlConstants, xlErrors).EntireRow.Delete
    On Error GoTo 0

Is there anyway to make it start searching after A5?

I have two statements that are exactly the same. The one in A5 needs to stay put, the other one needs to be deleted.
 
Last edited:

Excel Facts

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).
Try modifying the code you posted like this...

Code:
  With Range("A5", Cells(Rows.Count, "A").End(xlUp))
    .Replace "*section*", "#N/A", xlPart
    .Replace "*show*", "#N/A", xlPart
    On Error Resume Next
    .SpecialCells(xlConstants, xlErrors).EntireRow.Delete
    On Error GoTo 0
  End With

Can we assume that the words "section" or "show" will never be the first word in the cell? If it could be, and if its first letter is upper case, your Replace method calls could fail unless you specifically include the MatchCase argument (set to False).
 
Upvote 0
That worked great, I just had to change the Range to start at A6.

Thanks Rick! The original code I got was from you also.
 
Upvote 0

Forum statistics

Threads
1,214,801
Messages
6,121,644
Members
449,045
Latest member
Marcus05

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