View Single Post
  #5   Report Post  
Harlan Grove
 
Posts: n/a
Default

"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