Simple or Not?

August

Active Member
Joined
Jun 18, 2004
Messages
264
Can a cell be formatted so that whaterver text is typed in it is in Capitals, ideally this would be in a protected worksheet

Thanks
 

Some videos you may like

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"

tmischler

Well-known Member
Joined
Jun 17, 2004
Messages
669
don't know about formatting but I am sure it could be done with a macro in the workbook_change event. What range of cells do you want the formatting to apply to?
 

fairwinds

MrExcel MVP
Joined
May 15, 2003
Messages
8,638
Hi,

You cannot format a cell like that.

Try this code in the code module for the sheet in question.

Code:
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = Range("A1").Address Then Target = UCase(Target.Text)
End Sub
 

masim

Board Regular
Joined
Jun 19, 2003
Messages
130
fairwinds

Just for my academic interest - why this cant be done through data>validation>custom>formula ...

Regards
Asim
 

fairwinds

MrExcel MVP
Joined
May 15, 2003
Messages
8,638

ADVERTISEMENT

Hi masim.

You can use data validation to force a user to enter in upper case, but not to alter lowercase to uppercase.
 

masim

Board Regular
Joined
Jun 19, 2003
Messages
130
Thanks Fairwinds

.... and how to accomplish that :biggrin: ?

Regards
Asim
 

fairwinds

MrExcel MVP
Joined
May 15, 2003
Messages
8,638

ADVERTISEMENT

Allow custom.

Formula: =EXACT(A1,UPPER(A1))
 

August

Active Member
Joined
Jun 18, 2004
Messages
264
fairwinds said:
Hi,

You cannot format a cell like that.

Try this code in the code module for the sheet in question.

Code:
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = Range("A1").Address Then Target = UCase(Target.Text)
End Sub


Thank you....perfect as always
 

August

Active Member
Joined
Jun 18, 2004
Messages
264
August said:
fairwinds said:
Hi,

You cannot format a cell like that.

Try this code in the code module for the sheet in question.

Code:
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = Range("A1").Address Then Target = UCase(Target.Text)
End Sub


Thank you....perfect as always


I've tried applying the code to get "Proper Case" for range of cells in another worksheet. I put the codee in Worksheet and changed it as follows:
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = Range("A:A").Address Then Target = Proper(Target.Text)
End Sub


But it doesn't work for me.........where am I going wrong

Thanks
 

fairwinds

MrExcel MVP
Joined
May 15, 2003
Messages
8,638
Try:

Code:
Private Sub Worksheet_Change(ByVal Target As Range)
Application.EnableEvents = False
Set isect = Application.Intersect(Target, Range("A:A"))
If Not isect Is Nothing Then
Target = WorksheetFunction.Proper(Target.Text)
End If
Application.EnableEvents = True
End Sub
 

Watch MrExcel Video

Forum statistics

Threads
1,122,224
Messages
5,594,912
Members
413,952
Latest member
JGer

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