text in caps

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Guest
I want what to make sure the text in column E is caps how can this be done? Thanks
 

Excel Facts

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".
If you want to use data validation, choose custom and
=EXACT(A1,UPPER(A1)) for cell A1.

Note the major validation limitations, such as these will not keep a user from pasting in lower case letters.
 
Upvote 0
To test:

myrng = Range("e9")
If myrng = UCase(myrng) Then
'Task if Upper case
Else: 'task if lower case
'i.e., range("e9") = Ucase(myrng)
End If

Cheers, Nate
 
Upvote 0
Or you can force the issue without testing:

e.g.,

Sub Uppers()
Range("e1:e65536").Select
For Each cell In Selection
myrng = ActiveCell
ActiveCell = UCase(myrng)
ActiveCell.Offset(1, 0).Select
Next
End Sub

Cheers, Nate
 
Upvote 0
On 2002-02-25 13:02, NateO wrote:
Or you can force the issue without testing:

e.g.,

Sub Uppers()
Range("e1:e65536").Select
For Each cell In Selection
myrng = ActiveCell
ActiveCell = UCase(myrng)
ActiveCell.Offset(1, 0).Select
Next
End Sub

Cheers, Nate

One word of warning.
The above will convert any cells that contain formulas to values only.
To convert non-formula cells only to Upper :-

Sub Uppers()
Dim rng As Range, cell As Range
Set rng = Intersect(ActiveSheet.UsedRange, Columns(5))
For Each cell In rng
If cell.HasFormula = False Then
cell.Value = UCase(cell.Value)
End If
Next cell
End Sub

The following will convert cells to Upper and retain any formulas if the text being returned by the formula is contained as part of the formula(eg, ="a"), but will not convert to Upper if the result is obtained indirectly (eg, by a LOOKUP formula) :-

Sub Uppers()
Dim rng As Range, cell As Range
Set rng = Intersect(ActiveSheet.UsedRange, Columns(5))
For Each cell In rng
If cell.Formula <> "" Then
cell.Formula = Format(cell.Formula, ">")
End If
Next cell
End Sub
 
Upvote 0
Or if you want to automate it upon entries being made in column E :-

Private Sub Worksheet_Change(ByVal Target As Range)
Dim rng As Range, cell As Range
If Not Intersect(Selection, Columns(5)) Is Nothing Then
For Each cell In Intersect(Selection, Columns(5))
If cell.Formula <> "" Then
cell.Formula = Format(cell.Formula, ">")
End If
Next cell
End If
End Sub
 
Upvote 0
Correction. Better make that :-

Private Sub Worksheet_Change(ByVal Target As Range)
Dim rng1 As Range, rng2 As Range, cell As Range
Application.EnableEvents = False
If Not Intersect(Selection, Columns(5)) Is Nothing Then
Set rng1 = Intersect(Selection, Columns(5))
Set rng2 = Intersect(ActiveSheet.UsedRange, rng1)
For Each cell In rng2
If cell.Formula <> "" Then
cell.Formula = Format(cell.Formula, ">")
End If
Next cell
End If
Application.EnableEvents = True
End Sub
 
Upvote 0

Forum statistics

Threads
1,223,361
Messages
6,171,632
Members
452,411
Latest member
sprichwort

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