Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default lowercase to uppercase

Hi
How could I change (VBA code) every lowercase letter in a certain range into
a uppercase letter ?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 51
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
uppercase to lowercase Bob76 Excel Discussion (Misc queries) 5 February 14th 09 08:06 AM
Lowercase to uppercase workingwoman Excel Discussion (Misc queries) 3 September 14th 07 08:46 PM
uppercase to lowercase Missy Excel Worksheet Functions 1 February 3rd 05 09:10 PM
lowercase to uppercase Louise Excel Worksheet Functions 6 January 10th 05 09:41 PM
uppercase to lowercase Mammoth Excel Discussion (Misc queries) 3 November 28th 04 03:19 AM


All times are GMT +1. The time now is 01:27 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"