Help with Find and replace VBA

aaronr

New Member
Joined
Jul 8, 2010
Messages
34
Here is my issue. When i run the delete a row in VBA my find and replace code in VBA stops working. I looked thought all different find and replace Code and all do the same thing. Has any one easel ran into this issue or may be try different delete row code.

My delete row code -
Sub DeleteRowsWithFIREPROTECTIONInColumnE()
Columns("E").REPLACE "*FIRE PROTECTION*", "#N/A", xlWhole, , False, , False, False
On Error Resume Next
Columns("E").SpecialCells(xlConstants, xlErrors).EntireRow.Delete
On Error GoTo 0
End Sub


Sub ADDED_SHEET ()
With ThisWorkbook
.Sheets.Add(After:=.Sheets(.Sheets.Count)).Name = "test"
End With
Worksheets("Master sheet List").Range("A17:G1597").Copy
Worksheets("test").Range("A2").PasteSpecial Paste:=xlPasteFormulas
Application.CutCopyMode = False
ActiveSheet.Columns("B").REPLACE _
What:="test", Replacement:="fast", _
SearchOrder:=xlByColumns, MatchCase:=True
End Sub
 
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.
Instead of "Columns("E").SpecialCells(xlConstants, xlErrors).EntireRow.Delete", try "Cells(xlConstants, xlErrors).EntireRow.Delete".
 
Upvote 0
That version did the same thing. Wrote a different code that worked for me. Thanks for your help.
 
Upvote 0
For reference
When using replace, xl remembers your settings.
In your 2nd code you don't set the Lookat parameter, therefore xl will use the previous setting. In this case if you have already run the 1st code Lookat will be xlWhole, whereas the default is xlPart
 
Upvote 0

Forum statistics

Threads
1,214,990
Messages
6,122,625
Members
449,093
Latest member
catterz66

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