Remove_Between2Quotes

Remove any char (or string) found between two quotes in a string
This is an enhanced version of RemoveCommaBetween2Quotes that I needed to clear space found inside string having multiple pairs of double quotations, see examples.


Public

Tested

My Own Work
Function Remove_Between2Quotes(FullT, Optional Char2Remove = ",")
Dim Part2 As String, Part1 As String, Part3 As String
Rett = FullT
QFound1 = InStr(1, FullT, Chr(34))
QFound2 = QFound1 + 1
MidPart = ""
Do Until QFound1 = 0
QFound2 = InStr(QFound1 + 1, Rett, Chr(34))
If QFound2 > 0 Then
Part1 = Left(Rett, QFound1)
Part3 = Mid(Rett, QFound2 + 1)
MidPart = Mid(Rett, QFound1 + 1, QFound2 - QFound1)
MidPart = Replace(MidPart, Char2Remove, "")
End If
Rett = Part1 & MidPart & Part3
QFound1 = InStr(QFound2 + 1, Rett, Chr(34))
Loop
Remove_Between2Quotes = Rett
End Function

FullT, Optional Char2Remove = ","

Views 136 Downloads 44

VBA-Excel Texts + Strings
ANmarAmdeen
719
Attachments
Revisions

v1.0