Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
lowercase to uppercase
Hi
How could I change (VBA code) every lowercase letter in a certain range into a uppercase letter ? |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
lowercase to uppercase
There may be a trick that someone else can suggest, but here's a quick
sub to do it. You can replace "Selection" (i.e. the currently highlighted cells) with a specific range if you want: Sub Foo For Every c in Selection c.Value = UCase(c.Value) Next End Sub ___ John |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
lowercase to uppercase
Sub caps_it()
For Each r In Selection If Not IsEmpty(r) Then r.Value = UCase(r.Value) End If Next End Sub -- Gary''s Student - gsnu200720 "Pekka" wrote: Hi How could I change (VBA code) every lowercase letter in a certain range into a uppercase letter ? |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
lowercase to uppercase
Be careful with the two other suggestions
Both will convert formulas in the range to values A better way is to use SpecialCells See this two webpages http://www.mvps.org/dmcritchie/excel/proper.htm Or http://www.cpearson.com/excel/case.htm Here are some Macro's for changing text cells 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 Sub Lowercase_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 = LCase(cel.Value) Next cel Application.ScreenUpdating = True Application.Calculation = xlCalculationAutomatic End Sub Sub Propercase_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 = StrConv(cel.Value, vbProperCase) Next cel Application.ScreenUpdating = True Application.Calculation = xlCalculationAutomatic End Sub -- Regards Ron de Bruin http://www.rondebruin.nl/tips.htm "Pekka" wrote in message ... Hi How could I change (VBA code) every lowercase letter in a certain range into a uppercase letter ? |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
uppercase to lowercase | Excel Discussion (Misc queries) | |||
Lowercase to uppercase | Excel Discussion (Misc queries) | |||
uppercase to lowercase | Excel Worksheet Functions | |||
lowercase to uppercase | Excel Worksheet Functions | |||
uppercase to lowercase | Excel Discussion (Misc queries) |