PC Review


Reply
Thread Tools Rate Thread

Change Text Case to Upper in a cell range A2:A92

 
 
Barry
Guest
Posts: n/a
 
      23rd May 2007
I have a workbook of Contacts. In column A there are Names. I wish to
convert those to UPPER case. I've seen a few VB codes that change the case
to UPPER if I change something in the cell, GREAT if I want to go through
the entire Column and change something. But is there another way?


 
Reply With Quote
 
 
 
 
=?Utf-8?B?Z3I4cG9zdHM=?=
Guest
Posts: n/a
 
      23rd May 2007


"Barry" wrote:

> I have a workbook of Contacts. In column A there are Names. I wish to
> convert those to UPPER case. I've seen a few VB codes that change the case
> to UPPER if I change something in the cell, GREAT if I want to go through
> the entire Column and change something. But is there another way?
>
>
>

Use function =UPPER(A1) in a temporary column and then copy paste values to
column A.
Does this help ?

 
Reply With Quote
 
Barry
Guest
Posts: n/a
 
      23rd May 2007
Afraid not! That's not much better than my explanation about having to
change each cell manually. But thanks for the reply.


 
Reply With Quote
 
Barry
Guest
Posts: n/a
 
      23rd May 2007
Further explanation to my requested code.

The following code does what I want only if I change something in each cell.
My hope is to use code to automatically change the text in all cells in one
effort.
Private Sub Worksheet_Change(ByVal Target As Excel.Range)
Dim TheCell As Range
Application.EnableEvents = False
For Each TheCell In Target
If TheCell.HasFormula = False Then
If Not Application.Intersect(TheCell, Range("A1:A10")) Is
Nothing Then
TheCell.Value = UCase(TheCell.Value)
End If
End If
Next TheCell
Application.EnableEvents = True
End Sub


Cordially,
Chip Pearson


 
Reply With Quote
 
Dave Peterson
Guest
Posts: n/a
 
      23rd May 2007
If this is a one time thing, this may be the easiest suggestion that you get.

Maybe these links to Debra Dalgleish's site that shows how to fill a range would
make it easier.

http://contextures.com/xlDataEntry01.html#Quick
http://contextures.com/xlDataEntry01.html#Mouse

Barry wrote:
>
> Afraid not! That's not much better than my explanation about having to
> change each cell manually. But thanks for the reply.


--

Dave Peterson
 
Reply With Quote
 
Gord Dibben
Guest
Posts: n/a
 
      23rd May 2007
Barry

Sub optUpper_Click()
'David McRitchie, programming, 2003-03-07
Dim rng1 As Range, rng2 As Range, bigrange As Range
Dim cell As Range
Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual
On Error Resume Next
Set rng1 = Intersect(Selection, _
Selection.SpecialCells(xlCellTypeConstants))
Set rng2 = Intersect(Selection, _
Selection.SpecialCells(xlCellTypeFormulas))
On Error GoTo 0
If rng1 Is Nothing Then
Set bigrange = rng2
ElseIf rng2 Is Nothing Then
Set bigrange = rng1
Else
Set bigrange = Union(rng1, rng2)
End If
If bigrange Is Nothing Then
MsgBox "All cells in range are EMPTY"
GoTo done
End If
For Each cell In bigrange
cell.Formula = UCase(cell.Formula)
Next cell
done:
Application.Calculation = xlCalculationAutomatic
Application.ScreenUpdating = True
End Sub


Gord Dibben MS Excel MVP

On Tue, 22 May 2007 20:30:35 -0500, "Barry" <(E-Mail Removed)> wrote:

>Further explanation to my requested code.
>
>The following code does what I want only if I change something in each cell.
>My hope is to use code to automatically change the text in all cells in one
>effort.
>Private Sub Worksheet_Change(ByVal Target As Excel.Range)
>Dim TheCell As Range
>Application.EnableEvents = False
>For Each TheCell In Target
> If TheCell.HasFormula = False Then
> If Not Application.Intersect(TheCell, Range("A1:A10")) Is
>Nothing Then
> TheCell.Value = UCase(TheCell.Value)
> End If
> End If
>Next TheCell
>Application.EnableEvents = True
>End Sub
>
>
>Cordially,
>Chip Pearson
>


 
Reply With Quote
 
Michael Bednarek
Guest
Posts: n/a
 
      23rd May 2007
On Tue, 22 May 2007 20:30:35 -0500, Barry wrote in
microsoft.public.excel:

>Further explanation to my requested code.
>
>The following code does what I want only if I change something in each cell.
>My hope is to use code to automatically change the text in all cells in one
>effort.
>Private Sub Worksheet_Change(ByVal Target As Excel.Range)
>Dim TheCell As Range
>Application.EnableEvents = False
>For Each TheCell In Target
> If TheCell.HasFormula = False Then
> If Not Application.Intersect(TheCell, Range("A1:A10")) Is
>Nothing Then
> TheCell.Value = UCase(TheCell.Value)
> End If
> End If
>Next TheCell
>Application.EnableEvents = True
>End Sub


I may be missing something, but doesn't this trivial code do what you
want:

Sub SelUCase()

Dim rngCell As Range

For Each rngCell In Selection
rngCell = UCase(rngCell)
Next rngCell

End Sub

and then Alt+F8, or Menu: Tools/Macro/Macros..., or a button assigned to
the macro, to run it on the selected cells.

--
Michael Bednarek http://mbednarek.com/ "POST NO BILLS"
 
Reply With Quote
 
JE McGimpsey
Guest
Posts: n/a
 
      23rd May 2007
Try your code on a range with formulas and see what happens...


In article <(E-Mail Removed)>,
Michael Bednarek <ROT13-(E-Mail Removed)> wrote:

> I may be missing something, but doesn't this trivial code do what you
> want:
>
> Sub SelUCase()
>
> Dim rngCell As Range
>
> For Each rngCell In Selection
> rngCell = UCase(rngCell)
> Next rngCell
>
> End Sub
>
> and then Alt+F8, or Menu: Tools/Macro/Macros..., or a button assigned to
> the macro, to run it on the selected cells.
>

 
Reply With Quote
 
Michael Bednarek
Guest
Posts: n/a
 
      23rd May 2007
On Tue, 22 May 2007 22:34:59 -0600, JE McGimpsey wrote in
microsoft.public.excel:

>Try your code on a range with formulas and see what happens...


Point taken (formulas are converted to values) - thanks; easily fixed:
rngCell.Formula = UCase(rngCell.Formula)

OTOH:
On Tue, 22 May 2007 19:37:06 -0500, Barry wrote in
microsoft.public.excel:

>I have a workbook of Contacts. In column A there are Names. I wish to
>convert those to UPPER case.


>In article <(E-Mail Removed)>,
> Michael Bednarek wrote:
>
>> I may be missing something, but doesn't this trivial code do what you
>> want:
>>
>> Sub SelUCase()
>>
>> Dim rngCell As Range
>>
>> For Each rngCell In Selection
>> rngCell = UCase(rngCell)
>> Next rngCell
>>
>> End Sub
>>
>> and then Alt+F8, or Menu: Tools/Macro/Macros..., or a button assigned to
>> the macro, to run it on the selected cells.


--
Michael Bednarek http://mbednarek.com/ "POST NO BILLS"
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Shourtcut to change text written in upper case to lower case becksm Microsoft Word Document Management 4 26th Jan 2010 03:18 PM
Change text from lower case to upper case in Access 2007 Gloria Microsoft Access 1 30th Dec 2008 06:24 AM
Changing multiple cell text from lower case to upper case Patti Microsoft Excel Misc 2 4th Jan 2008 08:35 PM
Change the text from lower case to upper case in an Excel work boo =?Utf-8?B?ZGF2ZTAxOTY4?= Microsoft Excel Misc 2 9th Dec 2005 09:09 AM
Change case for all text in cell range R. Lehr Microsoft Excel Misc 5 28th Jan 2004 05:20 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 07:07 AM.