UCase Help

H

holder2k

How can I create a macro to UCase an entire spreadsheet ? I'd like t
utilize this function to make sure all characters on the sheet ar
Uppercase
 
H

Harald Staff

Sub UcaseUs()
Dim R As Range, C As Range
On Error Resume Next
Set R = Selection
Set R = Intersect(R, ActiveSheet.UsedRange)
Set R = R.SpecialCells(xlCellTypeConstants, 2)
If R Is Nothing Then Exit Sub
For Each C In R
C.Formula = UCase$(C.Formula)
Next
End Sub

Select any range of cells and run.
 
R

Ron de Bruin

Hi holder2k

See this webpages
http://www.mvps.org/dmcritchie/excel/proper.htm
Or
http://www.cpearson.com/excel/case.htm

Here is a macro for changing the cells with text in the selection

Sub Uppercase_macro()
Dim selectie As Range
Dim cel As Range
On Error Resume Next
Set selectie = Range(ActiveCell.Address & "," & Selection.Address) _
.SpecialCells(xlCellTypeConstants, xlTextValues)
If selectie Is Nothing Then Exit Sub
Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual
For Each cel In selectie
cel.Value = UCase(cel.Value)
Next cel
Application.ScreenUpdating = True
Application.Calculation = xlCalculationAutomatic
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top