PC Review


Reply
Thread Tools Rate Thread

Change a range to Uppercase

 
 
Roger Converse
Guest
Posts: n/a
 
      11th Jan 2008
Hello,

How would I update a range of cells to all uppercase?

My range is:

r = Range("A17:K" & i)

How could I create a loop or something that would change all cells in that
range to uppercase?

Thank you,
Roger
 
Reply With Quote
 
 
 
 
Nigel
Guest
Posts: n/a
 
      11th Jan 2008
Sub test()
Dim c As Range, r As Range, i As Long

i = 100 ' set for my test only!

Set r = Range("A17:K" & i)
For Each c In r
c.Value = UCase(c.Value)
Next

End Sub


--

Regards,
Nigel
(E-Mail Removed)



"Roger Converse" <(E-Mail Removed)> wrote in message
news:8A0C8DDE-C2C7-4365-BD54-(E-Mail Removed)...
> Hello,
>
> How would I update a range of cells to all uppercase?
>
> My range is:
>
> r = Range("A17:K" & i)
>
> How could I create a loop or something that would change all cells in that
> range to uppercase?
>
> Thank you,
> Roger


 
Reply With Quote
 
GB
Guest
Posts: n/a
 
      11th Jan 2008
One way (though not the only one) would be to establish a nested loop of two
variables one for the row and one for the column.

for i= (row start) to (row end)
for j = (column start) to (column end)
cell(i, j).text = Ucase(cell(i, j).text)
next j
next i

(my usage of cell(i, j) may need to be cells(i, j) or range (cells(i, j),
cells(i, j)) or even further activesheet.cells or activesheet.range) but it
at least gives the idea. Sorry that I haven't verified the exact usage of
cell(i, j).text but the function you are looking for is the UCASE() function.
"Roger Converse" wrote:

> Hello,
>
> How would I update a range of cells to all uppercase?
>
> My range is:
>
> r = Range("A17:K" & i)
>
> How could I create a loop or something that would change all cells in that
> range to uppercase?
>
> Thank you,
> Roger

 
Reply With Quote
 
Roger Converse
Guest
Posts: n/a
 
      11th Jan 2008
Works perfectly.

Thanks!
Roger

"Nigel" wrote:

> Sub test()
> Dim c As Range, r As Range, i As Long
>
> i = 100 ' set for my test only!
>
> Set r = Range("A17:K" & i)
> For Each c In r
> c.Value = UCase(c.Value)
> Next
>
> End Sub
>
>
> --
>
> Regards,
> Nigel
> (E-Mail Removed)
>
>
>
> "Roger Converse" <(E-Mail Removed)> wrote in message
> news:8A0C8DDE-C2C7-4365-BD54-(E-Mail Removed)...
> > Hello,
> >
> > How would I update a range of cells to all uppercase?
> >
> > My range is:
> >
> > r = Range("A17:K" & i)
> >
> > How could I create a loop or something that would change all cells in that
> > range to uppercase?
> >
> > Thank you,
> > Roger

>

 
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
Re: Change Uppercase to Lowercase Don Guillett Microsoft Excel Discussion 0 4th May 2008 02:48 PM
Change cell range to Uppercase ADK Microsoft Excel Programming 1 31st Jul 2007 09:44 PM
change from lowercase to uppercase =?Utf-8?B?SGVucnk=?= Microsoft Excel Programming 1 15th Mar 2006 08:20 PM
How do I change certain cells to Uppercase =?Utf-8?B?VGF6RGV2aWw=?= Microsoft Excel Worksheet Functions 4 1st Aug 2005 06:35 AM
Change to UpperCase =?Utf-8?B?cGVn?= Microsoft Outlook Form Programming 1 3rd Dec 2004 04:23 AM


Features
 

Advertising
 

Newsgroups
 


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