View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Mike H Mike H is offline
external usenet poster
 
Posts: 11,501
Default Most efficient code to "flip" a range of values + vs -

If you have to resort to code use this:-

Sub marine()
Set myrange = Range("A1:A3")
For Each c In myrange
c.Value = c.Value * -1
Next
End Sub

But if code can be avoided put -1 in a cell and copy. Select the range to
filp and paste special|multiply.

Mike

" wrote:

2003/2007



Range("A1").Value = Range("A1").Value * -1

will quickly flip "A1" 9999 to -9999

Let's assume that
Set myRange = Range("A1:A3")

How does one "flip" the values in myRange?

As myRange.Value = myRange.Value * -1 does not work.

TIA EagleOne