Hello,
Use this code and run the procedure, "ReplaceStrings"
It will place the results in column B then just copy and paste.
Option Explicit
Sub ReplaceStrings()
Dim sh As Worksheet
Dim rData As Range
Dim r As Range
Dim lRow As Long
Call TurnExtrasOff
Set sh = ActiveSheet
lRow = sh.Cells(sh.Rows.Count, 1).End(xlUp).Row
Set rData = sh.Range("C1").Resize(lRow)
For Each r In rData
Call GetString(r)
Next
Call TurnExtrasOn
MsgBox "All Finished!"
End Sub
Sub GetString(ByVal rDataVal As Range)
Dim rToSearch As Range
Dim rFound As Range
Dim strFirstAddress As String
Set rToSearch = Columns("A")
With rToSearch
Set rFound = .Find(What:=rDataVal.Value, _
After:=rToSearch.Resize(1, 1), _
LookIn:=xlFormulas, Lookat:=xlPart, _
SearchOrder:=xlByRows, _
SearchDirection:=xlNext, _
MatchCase:=True, Matchbyte:=False, _
SearchFormat:=False)
If Not rFound Is Nothing Then
strFirstAddress = rFound.Address
Do
Set rFound = .FindNext(rFound)
If rFound.Offset(, 1).Value = vbNullString Then
rFound.Offset(, 1).Value = rDataVal.Offset(, 1).Value
Else
rFound.Offset(, 1).Value = rFound.Offset(, 1).Value & rDataVal.Offset(, 1).Value
End If
Loop While Not rFound Is Nothing And rFound.Address <> strFirstAddress
End If
End With
'Clean up
Set rFound = Nothing
Set rToSearch = Nothing
End Sub
Sub TurnExtrasOff()
With Application
.ScreenUpdating = False
.Calculation = xlCalculationManual
.EnableEvents = False
End With
End Sub
Sub TurnExtrasOn()
With Application
.ScreenUpdating = True
.Calculation = xlCalculationAutomatic
.EnableEvents = True
End With
End Sub
Thanks
Bookmarks