ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   How do I change certain cells to Uppercase (https://www.excelbanter.com/excel-worksheet-functions/9283-how-do-i-change-certain-cells-uppercase.html)

TazDevil

How do I change certain cells to Uppercase
 
I have created a Worksheet in Excel 2000, but would like to format certain
cells so that they show in Uppercase text. Can anyone help with this?

Thanks

Don Guillett

this might be useful. Suggest putting in personal.xls.

Sub ChangeCase()
Application.ScreenUpdating = False
Dim r As Range
nCase = UCase(InputBox("Enter U for UPPER" & Chr$(13) & " L for
lower" & Chr$(13) & " Or " & Chr$(13) & " P for Proper", "Select
Case Desired"))
Select Case nCase
Case "L"
For Each r In Selection.Cells
If r.HasFormula Then
r.Formula = LCase(r.Formula)
'R.Formula = R.Value
Else
r.Value = LCase(r.Value)
End If
Next

Case "U"
For Each r In Selection.Cells
If r.HasFormula Then
r.Formula = UCase(r.Formula)
'R.Formula = R.Value
Else
r.Value = UCase(r.Value)
End If
Next
Case "P"

For Each r In Selection.Cells
If r.HasFormula Then
r.Formula = Application.Proper(r.Formula)
'R.Formula = R.Value
Else
r.Value = StrConv(r.Value, vbProperCase)
End If
Next
End Select
Application.ScreenUpdating = True
End Sub

--
Don Guillett
SalesAid Software

"TazDevil" wrote in message
...
I have created a Worksheet in Excel 2000, but would like to format certain
cells so that they show in Uppercase text. Can anyone help with this?

Thanks




JE McGimpsey

You can't format a cell to display in upper case, but you can use the
macro at

http://www.mvps.org/dmcritchie/excel/proper.htm#upper

In article ,
"TazDevil" wrote:

I have created a Worksheet in Excel 2000, but would like to format certain
cells so that they show in Uppercase text. Can anyone help with this?

Thanks


Harlan Grove

"TazDevil" wrote...
I have created a Worksheet in Excel 2000, but would like to format certain
cells so that they show in Uppercase text. Can anyone help with this?


No way to do this by formatting. Only using macros. If you want to do this
to appear all-caps immediately after entry, use a Change event handler.
First, select the cells that should be all-caps, and give that range the
defined name AllCapsRange. Then right-click on the worksheet tab and select
View Code from the pop-up menu. Enter the following Change event handler.


Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Target, _
Me.Names("AllCapsRange").RefersToRange) Is Nothing Then Exit Sub

On Error GoTo ExitProc
Application.EnableEvents = False

If Not Target.HasFormula And VarType(Target.Value) = vbString Then
Target.Value = IIf(Left(Target.Value, 1) Like "[=+]", "'", "") & _
UCase(Target.Value)
End If

ExitProc:
Application.EnableEvents = True
End Sub



danlmac7



"JE McGimpsey" wrote:

You can't format a cell to display in upper case, but you can use the
macro at

http://www.mvps.org/dmcritchie/excel/proper.htm#upper

In article ,
"TazDevil" wrote:

I have created a Worksheet in Excel 2000, but would like to format certain
cells so that they show in Uppercase text. Can anyone help with this?

Thanks




All times are GMT +1. The time now is 06:41 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com