Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

file 31 lines (25 sloc) 1.074 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
Attribute VB_Name = "LIB_Substitutes"



Function SuperSubV(strOldText As String, ByVal Rng1 As Range, ByVal rng2 As Range) As String
    Dim cel As Range
    Dim strMyChar As String, strMyReplace As String
    For Each cel In Rng1
        strMyChar = cel.Value
        strMyReplace = cel.Offset(0, rng2.Column - Rng1.Column).Value
         ' Next line does not work.
         'It would require a VBA version of Excel's SUBSTITUTE to work
        strOldText = Replace(strOldText, strMyChar, strMyReplace)

    Next cel
    SuperSubV = strOldText
End Function

Function SuperSubH(strOldText As String, ByVal Rng1 As Range, ByVal rng2 As Range) As String
    Dim cel As Range
    Dim strMyChar As String, strMyReplace As String
    For Each cel In Rng1
        strMyChar = cel.Value
        strMyReplace = cel.Offset(rng2.Row - Rng1.Row, 0).Value
         ' Next line does not work.
         'It would require a VBA version of Excel's SUBSTITUTE to work
        strOldText = Replace(strOldText, strMyChar, strMyReplace)

    Next cel
    SuperSubH = strOldText
End Function
Something went wrong with that request. Please try again.