View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
Sandy Mann
 
Posts: n/a
Default negative number to positive number

"Frank Kabel" wrote

There's a blast from the past. Where did this thread come from? Even in OE
"Show all messages" it is on its own

--

Sandy
In Perth, the ancient capital of Scotland


with @tiscali.co.uk


"Mike Casey" <Mike
wrote in message
...


"Frank Kabel" wrote:

Hi
- put -1 in an empty cell
- copy this cell
- select your negative numbers
- use 'Edit - Paste Special - Multiply'

--
Regards
Frank Kabel
Frankfurt, Germany

"fgiord" schrieb im Newsbeitrag
...
How can I change a negative number to positive number



Copy and paste the following macro into your personal macro workbook. All
you have to do is select what you want to negate and run the macro. I
assigned a custom button with the picture "(-)" and name "Negate
Selection".
Take notes Microsoft.

'Copy Below He

Sub Negate()
'
' Negate Macro
' Macro recorded 4/25/2006 by mcasey

Dim h, w, hctr, wctr As Integer
Dim selectionRange() As Variant

h = Selection.Rows.Count
w = Selection.Columns.Count
selectionRange = Selection.Value
hctr = 1
wctr = 1

While hctr <= h
While wctr <= w
selectionRange(hctr, wctr) = selectionRange(hctr, wctr) * -1
wctr = wctr + 1
Wend
wctr = 1
hctr = hctr + 1
Wend

Selection.Value = selectionRange

End Sub