PC Review


Reply
Thread Tools Rate Thread

Convert (-) to a (+) number Macro

 
 
Nikki
Guest
Posts: n/a
 
      17th Nov 2009
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.
 
Reply With Quote
 
 
 
 
Mike H
Guest
Posts: n/a
 
      17th Nov 2009
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.

 
Reply With Quote
 
Nikki
Guest
Posts: n/a
 
      17th Nov 2009
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.

 
Reply With Quote
 
K_Macd
Guest
Posts: n/a
 
      17th Nov 2009
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.

 
Reply With Quote
 
Mateen.jazz
Guest
Posts: n/a
 
      12th Dec 2009
'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 With Quote
 
Don Guillett
Guest
Posts: n/a
 
      12th Dec 2009
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
(E-Mail Removed)
"Mateen.jazz" <(E-Mail Removed)> wrote in message
news:1A1F45C3-A6F1-42B2-B461-(E-Mail Removed)...
> '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 With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro to Convert Value to Number, Sort, then Delete cardan Microsoft Excel Programming 16 10th Mar 2011 10:37 AM
Macro to convert a number to text (English only) John Google Microsoft Excel Discussion 4 18th Nov 2007 10:08 PM
need help with macro to convert number to date Dagonini Microsoft Excel Programming 2 8th Nov 2006 08:15 PM
error convert to number macro =?Utf-8?B?Y2hlcnJ5bmljaA==?= Microsoft Excel Programming 3 19th Jan 2006 01:26 PM
Convert a number formatted as text to a number in a macro MACRE0 Microsoft Excel Programming 2 22nd Oct 2005 02:51 AM


Features
 

Advertising
 

Newsgroups
 


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