Caps in brackets

Rumburak

Banned
Joined
Aug 28, 2018
Messages
36
Hi,,

In column A I have very many phrases.
Each phrase may or may not have one or more words in brackets.
How can I make all the words in brackets written in capital letters?

Thank you.
 

Excel Facts

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes
In column A I have very many phrases.
Each phrase may or may not have one or more words in brackets.
How can I make all the words in brackets written in capital letters?
Assuming you meant [ and ] as your brackets, give this macro a try...
Code:
[table="width: 500"]
[tr]
	[td]Sub CapitalizeTextInBrackets()
  Dim R As Long, X As Long, Txt() As String, Data As Variant
  Data = Range("A1", Cells(Rows.Count, "A").End(xlUp))
  For R = 1 To UBound(Data)
    Txt = Split(Data(R, 1), "[")
    For X = 1 To UBound(Txt)
      Mid(Txt(X), 1, InStr(Txt(X), "]")) = UCase(Mid(Txt(X), 1, InStr(Txt(X), "]")))
    Next
    Data(R, 1) = Join(Txt, "[")
  Next
  Range("A1").Resize(UBound(Data)) = Data
End Sub[/td]
[/tr]
[/table]
 
Upvote 0

Forum statistics

Threads
1,215,430
Messages
6,124,849
Members
449,194
Latest member
HellScout

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top