Re: Macro not working in 2007

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



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 <Rick@xxxxxxxxxxxxxxxxxxxxxxxxx>
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" <Rick@xxxxxxxxxxxxxxxxxxxxxxxxx> a écrit dans le message de news:
FDCBC8B9-4E6A-4823-9744-E97210774A52@xxxxxxxxxxxxxxxx
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




.



Relevant Pages

  • Re: specify cell selection in a marco
    ... Sub Uppercase() ... ' Loop to cycle through each cell in the specified range. ... ' Change the text in the range to uppercase letters. ...
    (microsoft.public.excel.misc)
  • rotate revisited
    ... Suppose we have an array A containing n equi-spaced elements. ... The cost of this method (excluding loop costs) is: ... Each cycle is of length n/d. ... I will use the term "small slide" for a data move that is less ...
    (comp.programming)
  • Re: picking a new random seed
    ... avoid reusing the same random number sequence, I wrote a loop to run ... The real-time cycle counter on modern X86 processors provide a ... should change often (every machine cycle!) enough to keep Charles ... one of the more modern RNG algorithms if cycle size, ...
    (comp.lang.apl)
  • Re: Finding longest path in graph between two vertices
    ... is a cycle? ... path might be running through the loop (same vertices multiple ... I disagree with your definition. ... standard graph-theory terminology says that an arbitrary sequence ...
    (sci.math)
  • Re: PIC + DDS = Frequency Synthesizer?
    ... thus the software calculation loop cycle time ... are 20 instructions available to update the phase accumulator, ... lookup and control the DAC. ... software loop cycle. ...
    (comp.arch.embedded)