Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
'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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Macro to convert phone number to time zone | Excel Programming | |||
need help with macro to convert number to date | Excel Programming | |||
error convert to number macro | Excel Programming | |||
Convert a number formatted as text to a number in a macro | Excel Programming | |||
convert decimal number to time : convert 1,59 (minutes, dec) to m | Excel Discussion (Misc queries) |