ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Convert (-) to a (+) number Macro (https://www.excelbanter.com/excel-programming/436278-convert-number-macro.html)

Nikki

Convert (-) to a (+) number Macro
 
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.

Mike H

Convert (-) to a (+) number Macro
 
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

"Nikki" wrote:

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.


Nikki

Convert (-) to a (+) number Macro
 
Thanks - that was easy

"Mike H" wrote:

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

"Nikki" wrote:

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.


K_Macd

Convert (-) to a (+) number Macro
 
No need for a macro - just use the ABS() function in your formula

--
Ken
"Using Dbase dialects since 82"
"Started with Visicalc in the same year"


"Nikki" wrote:

Thanks - that was easy

"Mike H" wrote:

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

"Nikki" wrote:

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.


Mateen.jazz

Convert (-) to a (+) number Macro
 
'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

Don Guillett

Convert (-) to a (+) number Macro
 
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

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Mateen.jazz" wrote in message
...
'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




All times are GMT +1. The time now is 07:29 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com