Hello!
I wrote some function and want to repeat it as many times as it corresponds to the condition.
Function that replaces some part of a string to another by condition:
Function (UDF) that should repeat the first one more than one time if it corresponds to the condition:
But anyway it make one replace only.
Help me please to fix it.
I wrote some function and want to repeat it as many times as it corresponds to the condition.
Function that replaces some part of a string to another by condition:
Code:
Function fone(ByVal sss As String) As String
Dim aaa As Long '---
Dim fff As Long '---
Dim bbb As Long '---
Dim ccc As Long '---
Dim rrr As String '---
Dim ttt As String '---
Dim uuu As String '---
Dim vvv As String '---
On Error GoTo Error_handler:
aaa = InStr(sss, "type-by-")
ccc = InStr(aaa, sss, Chr(34))
ttt = Mid(sss, 1, ccc)
uuu = Mid(ttt, InStrRev(ttt, "begin") + 6, Len(ttt) - (InStrRev(ttt, "begin") + 6))
rrr = Replace(uuu, "-by-", "")
rrr = Replace(rrr, "-of-", "")
fff = ((Len(uuu) - Len(rrr)) / 4)
Select Case fff
Case 0
fone = sss
Case 1
On Error GoTo Error_handler:
vvv = Replace(Replace(uuu, "partonetype-by-", ""), "parttwo", "")
fone = Replace(sss, Chr(34) & uuu & Chr(34), Chr(34) & vvv & Chr(34))
Case Is > 1
fone = sss
End Select
Exit Function
Error_handler:
fone = sss
End Function
Function (UDF) that should repeat the first one more than one time if it corresponds to the condition:
Code:
Function ftwo(ByVal sss As String) As String
ftwo = fone(sss)
End Function
But anyway it make one replace only.
Help me please to fix it.
Last edited: