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.
 

Some videos you may like

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.

Rick Rothstein

MrExcel MVP
Joined
Apr 18, 2011
Messages
36,712
Office Version
  1. 2010
Platform
  1. Windows
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]
 

Watch MrExcel Video

Forum statistics

Threads
1,123,310
Messages
5,600,879
Members
414,413
Latest member
Sinbin

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
Top