Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 184
Default 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.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default 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.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 184
Default 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.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 54
Default 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.

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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


  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,124
Default 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


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro to convert phone number to time zone LindaC Excel Programming 1 February 5th 09 06:51 AM
need help with macro to convert number to date Dagonini Excel Programming 2 November 8th 06 08:15 PM
error convert to number macro cherrynich Excel Programming 3 January 19th 06 01:26 PM
Convert a number formatted as text to a number in a macro MACRE0[_5_] Excel Programming 2 October 22nd 05 02:51 AM
convert decimal number to time : convert 1,59 (minutes, dec) to m agenda9533 Excel Discussion (Misc queries) 8 January 20th 05 10:24 PM


All times are GMT +1. The time now is 02:12 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"