Home |
Search |
Today's Posts |
#1
|
|||
|
|||
Function to reverse the sign of a cell
I'd like to see a function or a toolbar button that would allow you to
reverse the sign of numbers in a selection. Thanks! ---------------- This post is a suggestion for Microsoft, and Microsoft responds to the suggestions with the most votes. To vote for this suggestion, click the "I Agree" button in the message pane. If you do not see the button, follow this link to open the suggestion in the Microsoft Web-based Newsreader and then click "I Agree" in the message pane. http://www.microsoft.com/office/comm...et.f unctions |
#2
|
|||
|
|||
You could always use a macro and assign it to a new button on a toolbar:
Sub ChangeSigns() Dim cell As Range Application.ScreenUpdating = False On Error GoTo NoRangeFound For Each cell In Selection.SpecialCells(xlCellTypeConstants, 1) cell.Value = cell.Value * -1 Next Application.ScreenUpdating = True Exit Sub NoRangeFound: MsgBox "No values found!" Application.ScreenUpdating = True End Sub --- This will only change numerical constants, not formulas returning numerical values. HTH Jason Atlanta, GA "epowell74" wrote: I'd like to see a function or a toolbar button that would allow you to reverse the sign of numbers in a selection. Thanks! ---------------- This post is a suggestion for Microsoft, and Microsoft responds to the suggestions with the most votes. To vote for this suggestion, click the "I Agree" button in the message pane. If you do not see the button, follow this link to open the suggestion in the Microsoft Web-based Newsreader and then click "I Agree" in the message pane. http://www.microsoft.com/office/comm...et.f unctions |
#3
|
|||
|
|||
I was thinking this could be available more for novice users who don't know
how to create a macro. I think it would be nice to have a standard function like SUM that users could use. Thanks, Emily "Jason Morin" wrote: You could always use a macro and assign it to a new button on a toolbar: Sub ChangeSigns() Dim cell As Range Application.ScreenUpdating = False On Error GoTo NoRangeFound For Each cell In Selection.SpecialCells(xlCellTypeConstants, 1) cell.Value = cell.Value * -1 Next Application.ScreenUpdating = True Exit Sub NoRangeFound: MsgBox "No values found!" Application.ScreenUpdating = True End Sub --- This will only change numerical constants, not formulas returning numerical values. HTH Jason Atlanta, GA "epowell74" wrote: I'd like to see a function or a toolbar button that would allow you to reverse the sign of numbers in a selection. Thanks! ---------------- This post is a suggestion for Microsoft, and Microsoft responds to the suggestions with the most votes. To vote for this suggestion, click the "I Agree" button in the message pane. If you do not see the button, follow this link to open the suggestion in the Microsoft Web-based Newsreader and then click "I Agree" in the message pane. http://www.microsoft.com/office/comm...et.f unctions |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How do I obtain the address of a cell using the vlookup function? | Excel Worksheet Functions | |||
How do I find the contents of a cell using the "ADDRESS" function. | Excel Worksheet Functions | |||
Get current cell with VBA function | Excel Worksheet Functions | |||
Using the MAX function with "constant increment" cell references | Excel Worksheet Functions | |||
Function to return colour of formatted cell | Excel Worksheet Functions |