onsdag 27 februari 2013

Substitute multiple text strings


Formula:
=SubstituteMultiple(Text; Old_Text; New_Text)

VBA code
Function SubstituteMultiple(text As String, old_text As Range, new_text As Range)
Dim i As Single
For i = 1 To old_text.Cells.Count
    Result = Replace(LCase(text), LCase(old_text.Cells(i)), LCase(new_text.Cells(i)))
    text = Result
Next i
SubstituteMultiple = Result
End Function

Source: link

Inga kommentarer: