ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Transform positive numbers into negative (https://www.excelbanter.com/excel-programming/383216-transform-positive-numbers-into-negative.html)

Robert[_30_]

Transform positive numbers into negative
 
Hi All,

Does anyone know which statement to use for changing a range of
positive numbers (say range("A1:A10") into negative?

Thanks again!

Rgds,
Robert


RichardSchollar

Transform positive numbers into negative
 
Hi Robert

Maybe:

Set rng = Range("A1:A10")
rng.Value = Evaluate(rng.Address & "*-1")

Hope this helps!

Richard

On 14 Feb, 13:39, "Robert" wrote:
Hi All,

Does anyone know which statement to use for changing a range of
positive numbers (say range("A1:A10") into negative?

Thanks again!

Rgds,
Robert




Don Guillett

Transform positive numbers into negative
 
try
Sub changepostoneg()
For Each c In Range("a1:a10")
If c 0 Then c.Value = -c
Next
End Sub


--
Don Guillett
SalesAid Software

"Robert" wrote in message
oups.com...
Hi All,

Does anyone know which statement to use for changing a range of
positive numbers (say range("A1:A10") into negative?

Thanks again!

Rgds,
Robert




Peter T

Transform positive numbers into negative
 
One more - manually (or record macro)

copy a cell containing -1
select cells to be negated
PasteSpecial multiply

Regards,
Peter T

"Robert" wrote in message
oups.com...
Hi All,

Does anyone know which statement to use for changing a range of
positive numbers (say range("A1:A10") into negative?

Thanks again!

Rgds,
Robert




Jim Jackson

Transform positive numbers into negative
 
Sub PositivetoNegative()
Range("A1").Activate
Do
If Left(Activecell,1) < "-" then
Activecell = Activecell*-1
End If
Activecell.Offset(1,0).Activate
Loop until Activecell = ""
End Sub
--
Best wishes,

Jim


"Robert" wrote:

Hi All,

Does anyone know which statement to use for changing a range of
positive numbers (say range("A1:A10") into negative?

Thanks again!

Rgds,
Robert




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

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com