changing positive to negative numbers

L

Laura Fraser

I have data copied from another source that needs to
routinely be changed to show as negative numbers. In
Lotus one could create a Macro to change all numbers in
an area from positive to negative. Any ideas how this can
be done in Excel. Any help will be appreciated.
 
D

Dan E

Put -1 in a cell
Copy that cell
Select the range you want to change signs in
Paste Special & Choose Multiply

Dan E
 
D

Dan E

Here's a macro that will make the selected range change signs

Sub Negatives()
For Each Cell In Selection
Cell.Value = -Cell.Value
Next
End Sub

Dan E
 
D

David McRitchie

Hi Laura,
you could use On Error Resume Next
in case there were any non numeric constants

If they are only going to be constants and never formulas
which Dan's macro would have destroyed anyway you might use

Sub ChangeSign()
Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual
Dim cell As Range
On Error Resume Next
For Each cell In Selection.Cells.SpecialCells(xlConstants, xlNumbers)
cell.Value = -cell.value
next cell
Application.Calculation = xlCalculationAutomatic
Application.ScreenUpdating = True
End Sub

instructions for installing / using a macro on my
http://www.mvps.org/dmcritchie/excel/getstarte.htm
--
 
D

Dan E

I have data copied from another source that needs to
Not often imported data contains formulas to "destroy"???
The On Error Resume Next isn't a bad idea though.

Dan E
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top