• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Multiple Find Replace

GB

Member
Hi,
I have a large data set in one worksheet (Sheet1) of my workbook. I want to find all cells that begin with, end with, cells with exact match, or contain, then delete these from the worksheet. See example...

abc*
*now
dog mat
*ouch*

Does anyone have some vba code I can reuse to make this happen?

Thanks
GB
 
Hi GB

Give the following a try. Should get rid of all of your data.

Code:
Sub FindRepMulti() 'Excel VBA for replace with wildcard.
    Dim ar As Variant
    Dim i As Integer
    ar = [{"abc*", "*now", "dog mat", "*ouch*"}]
 
    For i = 1 To UBound(ar)
        Cells.Replace ar(i), ""
    Next i
   
End Sub

Take care

Smallman
 
Back
Top