This will Start at Cell A1 and replace all cells in column A (down to first blank cell) with whatever value or data you have entered in Cell C1. You can change the cell range to whatever cell you prefer in the code.
Code for using C1:
Code:Sub Replace_Content() Dim x As String Dim Y As String Y = Range("C1") With Range("a1", Range("a" & Rows.Count).End(xlUp)) x = .Address .Value = WorksheetFunction.Substitute(Y, origString, newString) End With End Sub
if you will always be substituing the same value all the time you can just replace the x right next to the Substitute command in your original code.Code:.Value = WorksheetFunction.Substitute("101-A", origString, newString)
Bookmarks