In Excel VBA how do I change all occurrences of text between { }
to lowercase?
I want to browse the whole of columns A & B and each time I find text between { }, I would like to change it to lowercase.
The code works on the first occurrence.
When there are multiple occurrences in the cell I could not change all of them to lowercase.
E.g.
In a cell: "Bla Bla Bla {Abc} bla bla {xYz} and {HELLO}"
Result: "Bla Bla Bla {abc} bla bla {xYz} and {HELLO}"
Expected: "Bla Bla Bla {abc} bla bla {xyz} and {hello}"
If I run the code again it is applying only on the first occurrence.
Dim c As Range
Set MyRange = Worksheets("Sheet1").Range("G:G,H:H")
Dim temp As String
For Each c In MyRange
If c.Value Like "*{*" Then
temp = Split(c.Value, "{")(1)
temp = Split(temp, "}")(0)
c.Value = Replace(c.Value, temp, LCase(temp))
Else
End If
Next c
End Sub