1234567891011121314151617181920212223242526 |
- Function vreplace(str As String, insep As String, outsep As String, rng As Range, idx As Integer) As String
-
-
-
- Dim strArray() As String
- Dim i As Integer
- Dim crtStr As String
- Dim coll As New Collection
- Set coll = New Collection
- strArray = (Split(str, insep))
- For i = LBound(strArray) To UBound(strArray)
-
-
- crtStr = Application.VLookup(strArray(i), rng, idx, False)
- On Error GoTo Skip:
- coll.Add crtStr, crtStr
- vreplace = vreplace & outsep & crtStr
- Skip: Resume Continue:
- Continue:
- Next
-
- vreplace = Right(vreplace, Len(vreplace) - 1)
- End Function
|