Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 09-24-2018, 07:21 AM
rsrasc rsrasc is offline Need Macro to Convert Numbers from Positive to Negative Windows 10 Need Macro to Convert Numbers from Positive to Negative Office 2013
Competent Performer
Need Macro to Convert Numbers from Positive to Negative
 
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
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
Need Macro to Convert Numbers from Positive to Negative Need Macro to Convert Text To Numbers in Multiple Sheets rsrasc Excel Programming 4 04-11-2016 06:21 AM
Need Macro to Convert Numbers from Positive to Negative Excel VBA to convert number to negative dakm63 Excel Programming 1 05-26-2015 10:49 AM
Need Macro to Convert Numbers from Positive to Negative Table cells with negative numbers being displayed in two lines HankBrandenburg Word Tables 1 02-17-2014 03:04 PM
Custom formatting to make negative numbers show w/o negative sign on charts todor PowerPoint 3 01-16-2013 03:45 AM
Need Macro to Convert Numbers from Positive to Negative How to add the plus sign (+) automatically for the numbers which are positive? Jamal NUMAN Excel 2 05-01-2011 03:15 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 09:27 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft