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

Which came first: VisiCalc or Lotus 1-2-3?
Dan Bricklin and Bob Frankston debuted VisiCalc in 1979 as a Visible Calculator. Lotus 1-2-3 debuted in the early 1980's, from Mitch Kapor.
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,215,415
Messages
6,124,764
Members
449,187
Latest member
hermansoa

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