View Single Post
 
Old 09-24-2018, 07:21 AM
rsrasc rsrasc is offline Windows 10 Office 2013
Competent Performer
 
Join Date: Mar 2014
Location: Germany
Posts: 148
rsrasc is on a distinguished road
Default Need Macro to Convert Numbers from Positive to Negative

Hi all,

I have a file with the name "FY 19-Budget (with macro extension).

Within the file, I have three sheets with the following names:

130R
135R
140R

From cell E4 to P45, I have numbers on it.

Some of the cells also have the following values: "0.00"


If possible, I would like to have a macro that will convert the values from positive to negative in all the cells from E4 to P45 (I guess anything greater than zero).

I found the below code but don't know how to use it in my situation.

Code:
Sub test() 
For Each Cell In Range("a1:z100") 
If Cell.Value > 0 Then 
    Cell.Value = cell.value * -1 
End If 
Next Cell 
End Sub

To illustrate, for example, in cell E4, under sheet 130R, I have the following value:

1051.00

After conversion, the value in E4 will be, for example:

-1051.00



Any questions, please let me know.


As always, thank you for your support.


Much appreciated,

rsrasc
Reply With Quote