![]() |
MACRO: How to change cells to negative value
For something that seems so simple, I cannot come up with
a solution. I want to run a macro that will change the contents of a cell from a positive number to a negative number. For example, if I have 1000 in A1, I will select A1 and run a macro that will change its value to -1000. Thanks in advance. |
MACRO: How to change cells to negative value
Sub simple()
activecell.value=activecell.value * -1 End Sub Tony wrote: For something that seems so simple, I cannot come up with a solution. I want to run a macro that will change the contents of a cell from a positive number to a negative number. For example, if I have 1000 in A1, I will select A1 and run a macro that will change its value to -1000. Thanks in advance. |
MACRO: How to change cells to negative value
Or,
Sub even_simpler() ActiveCell.Value = -ActiveCell.Value End Sub If you *always* want a negative number: Sub always_negative() ActiveCell.Value = -Abs(ActiveCell.Value) End Sub In article , JWolf wrote: Sub simple() activecell.value=activecell.value * -1 End Sub Tony wrote: For something that seems so simple, I cannot come up with a solution. I want to run a macro that will change the contents of a cell from a positive number to a negative number. For example, if I have 1000 in A1, I will select A1 and run a macro that will change its value to -1000. Thanks in advance. |
All times are GMT +1. The time now is 09:59 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com