Convert (-) to a (+) number Macro

N

Nikki

Does anyone know what macro I could use to convert a (-) number to a (+)
number? For example, I have -8.96% and need to change it to 8.96% to show a
negative $ amount in my calculation. All I need is to remove the (-) symbol.
 
M

Mike H

Hi,

You probably don't need a macro. Put -1 in a cell and copy it. Select the
number(s) to convert and then

Edit|Paste Special - Select 'Multiply' - OK

Delete the -1

Mike
 
N

Nikki

Thanks - that was easy

Mike H said:
Hi,

You probably don't need a macro. Put -1 in a cell and copy it. Select the
number(s) to convert and then

Edit|Paste Special - Select 'Multiply' - OK

Delete the -1

Mike
 
M

Mateen.jazz

'If u are looking for a macro to do that below is the code
but be aware it converts blank to zero
Sub macro2()
Dim k As Range
Set k = Application.InputBox(Prompt:="Please select the range",
Title:="Specify range", Type:=8)
On Error Resume Next
If k Is Nothing Then
Exit Sub
Else
For Each cell In k
cell.Value = -cell.Value
Next cell
End If
End Sub
 
D

Don Guillett

Try it this way to compensate for any blanks and inadvertent touching of the
dreaded space bar

Sub macro2SAS()
Dim k As Range
Set k = Application.InputBox(Prompt:= _
"Please select the range", _
Title:="Specify range", Type:=8)
On Error Resume Next
If k Is Nothing Then
Exit Sub
Else
For Each cell In k
If Len(Application.Trim(cell)) > 0 Then
cell.Value = Abs(cell.Value)
End If
Next cell
End If
End Sub
 

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