Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 334
Default Macro not working in 2007

I had the below macro to change text into Uppercase in Excel 2003 but now in
2007 it doesn't work.

It seems to get stuck on the For Each x.

Can anyone tell me why?

Thanks
Rick


Sub Uppercase()
' Loop to cycle through each cell in the specified range.
For Each x In Range(Selection, Selection.End(xlDown))
' Change the text in the range to uppercase letters.
x.Value = UCase(x.Value)
Next
End Sub
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 110
Default Macro not working in 2007

Hi Rick
What is the error message?
But never mind, obviously the code is correct, so i would think this is
probably due to the missing declaration of x.
In which case amend:
Sub Uppercase()
' Loop to cycle through each cell in the specified range.
Dim x As Range
For Each x In Range(Selection, Selection.End(xlDown))
' Change the text in the range to uppercase letters.
x.Value = UCase(x.Value)
Next x
End Sub

HTH
Cordially
Pascal

"Rick" a écrit dans le message de news:
...
I had the below macro to change text into Uppercase in Excel 2003 but now
in
2007 it doesn't work.

It seems to get stuck on the For Each x.

Can anyone tell me why?

Thanks
Rick


Sub Uppercase()
' Loop to cycle through each cell in the specified range.
For Each x In Range(Selection, Selection.End(xlDown))
' Change the text in the range to uppercase letters.
x.Value = UCase(x.Value)
Next
End Sub



  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 334
Default Macro not working in 2007

Thanks that fixed it. It seems strange because the macro used to work as it
was.

"papou" wrote:

Hi Rick
What is the error message?
But never mind, obviously the code is correct, so i would think this is
probably due to the missing declaration of x.
In which case amend:
Sub Uppercase()
' Loop to cycle through each cell in the specified range.
Dim x As Range
For Each x In Range(Selection, Selection.End(xlDown))
' Change the text in the range to uppercase letters.
x.Value = UCase(x.Value)
Next x
End Sub

HTH
Cordially
Pascal

"Rick" a écrit dans le message de news:
...
I had the below macro to change text into Uppercase in Excel 2003 but now
in
2007 it doesn't work.

It seems to get stuck on the For Each x.

Can anyone tell me why?

Thanks
Rick


Sub Uppercase()
' Loop to cycle through each cell in the specified range.
For Each x In Range(Selection, Selection.End(xlDown))
' Change the text in the range to uppercase letters.
x.Value = UCase(x.Value)
Next
End Sub




  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 22,906
Default Macro not working in 2007

Rick

Just a head's up.

Are you aware that your macro will wipe out any formulas you may have in the
range?

Maybe a change.............?

Sub Uppercase()
' Loop to cycle through each cell in the specified range.
Dim x As Range
For Each x In Range(Selection, Selection.End(xlDown))
' Change the text in the range to uppercase letters.
If Not x.HasFormula Then
x.Value = UCase(x.Value)
End If
Next x
End Sub


Gord Dibben MS Excel MVP

On Wed, 1 Oct 2008 01:30:01 -0700, Rick
wrote:

Thanks that fixed it. It seems strange because the macro used to work as it
was.

"papou" wrote:

Hi Rick
What is the error message?
But never mind, obviously the code is correct, so i would think this is
probably due to the missing declaration of x.
In which case amend:
Sub Uppercase()
' Loop to cycle through each cell in the specified range.
Dim x As Range
For Each x In Range(Selection, Selection.End(xlDown))
' Change the text in the range to uppercase letters.
x.Value = UCase(x.Value)
Next x
End Sub

HTH
Cordially
Pascal

"Rick" a écrit dans le message de news:
...
I had the below macro to change text into Uppercase in Excel 2003 but now
in
2007 it doesn't work.

It seems to get stuck on the For Each x.

Can anyone tell me why?

Thanks
Rick


Sub Uppercase()
' Loop to cycle through each cell in the specified range.
For Each x In Range(Selection, Selection.End(xlDown))
' Change the text in the range to uppercase letters.
x.Value = UCase(x.Value)
Next
End Sub





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
F2 Key not working in Excel 2007 JodieM Excel Discussion (Misc queries) 2 November 18th 10 08:21 PM
Working Between Excell 2003 & 2007 Val Excel Worksheet Functions 2 August 14th 08 10:03 PM
Watch Window not working in 2007 campingshadow Setting up and Configuration of Excel 0 August 12th 08 05:16 PM
Excel 2007 - sum function not working IVCC Excel Worksheet Functions 2 June 10th 08 12:09 AM
Excel 2007 Macro Help (Excel 2003 not working in 2007) Pman Excel Discussion (Misc queries) 4 May 29th 08 06:29 PM


All times are GMT +1. The time now is 08:42 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"