LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default How can I make a Macro work multiple rows instead of one?

Hi all,
The macro below is for a basic calculation as shown:
G H I J
Inventory Orders Safety Production
45 25 10 -10 (H3+I3-G3)

If the Production J3 is negative, change the safety (I3) to a number
so that Production will be 0. In this case, Safety should be 20 in
order for Production to be 0.
The Macro below works perfectly, but it only changes this specific
cells (I3 and J3). I have 300 rows. How can I change this Macro below
so that when I run it, it affects 300 rows instead of just 1?
Thank you

Sub Solve()


'J3=production cell
a = Range("J3").Value


'I3=safety cell
b = Range("I3").Value


If a < 0 Then


Range("I3").Value = b + a * -1
End If


End Sub

 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Want to make changes to multiple excel work books at one time RHein Excel Discussion (Misc queries) 3 December 18th 07 05:44 PM
Can't make loop macro work - help? [email protected] Excel Programming 1 October 11th 06 03:23 PM
If I have a work sheet protected and try to run a macro to hide rows or columns it won't work. Correct? Marc Excel Programming 2 July 12th 06 04:10 AM
how do I debug my Excel macro & make it actually WORK? Brainless_in_Boston[_2_] Excel Programming 13 February 16th 06 07:20 PM
How do I make a macro work in one worksheet only Hawkfan757 Excel Programming 1 January 11th 05 05:43 PM


All times are GMT +1. The time now is 03:33 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"