dutchmenqb
New Member
- Joined
- Jul 6, 2016
- Messages
- 19
I have one sheet with a Vendor column that has non-exact matches. (e.g. Walmart #6511 vs. Walmart #1654). I want to make all of those nonexact matches the same (Turn the example values into just Walmart.) I was not able to find a way to directly remove the non-exact matches. This led me to writing code to filter by the beginning of the cell's value (enter in Walmart) and then code to replace all visible cells with Walmart. However, I have 45,000 lines of data, and I do not want to go through each and every one.
In a separate sheet, I have a list of all of the vendor names with duplicates removed. I am hoping to have my code for filtering loop through the list of vendors rather than entering each and every value individually. I'm hoping to loop the code below through my vendor list:
Thank you for any and all help
In a separate sheet, I have a list of all of the vendor names with duplicates removed. I am hoping to have my code for filtering loop through the list of vendors rather than entering each and every value individually. I'm hoping to loop the code below through my vendor list:
Code:
Sub FilterReplace()
Application.DisplayAlerts = False
Dim filtervendor As String
filtervendor = InputBox("Enter Vendor to filter by")
Range("AP1").Value = filtervendor
Range("A2:A45379").AutoFilter Field:=1, Criteria1:=Range("AP1") & "*"
Dim newname As String
newname = InputBox("Enter the new vendor name")
Range("AQ1").Value = newname
Range("A2:A45379").SpecialCells(xlCellTypeVisible).Value = newname
Range("A1").Select
ActiveWorkbook.SaveAs Filename:="C:\Users\jagross\Documents\Project CCS\Credit Card Spend.xlsm"
Application.DisplayAlerts = True
End Sub
Thank you for any and all help