Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 386
Default 4 Macro inputs, 1 out

Hi,

I have four macros on two different excel sheets all controlling a value in
the same cell. On sheet 1 I have two macros which either add or subtract 1
from cell I38 every time the button is pushed. On sheet 2 I have another two
macros which do the same thing - they add and subtract 1 from cell L6.

I need cell L6 from sheet 2 to update the value in sheet 1 cell I38 then
reset to zero, but maintain the value in cell I38 sheet 1.

Example:
- I hit +1 five times and -1 twice on sheet 1. My stock, (cell I38 sheet
1), goes from 20 to 23.
- I then hit +1 ten times and -1 once on sheet 2. Cell L6 on sheet 2 will
show that I have entered a total of 9 times.
- Cell L6 will then update cell I38 on sheet 1 from 23 to 32.
- Cell L6 sheet 2 will reset to zero and cell I38 sheet 1 will stay at 32
until the next update arrives.

Is this possible? I have attached the +1 macro i am using below for
reference - maybe i need something different to do all the operations.

Thanks for your help

Sub Production15()
With Sheet2 ' Changer to suit
If Range("L6").Value < "" Then ' Change L6 to suit
Range("L6").Value = Range("L6").Value + 1
End If
End With
End Sub

Thanks

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,986
Default 4 Macro inputs, 1 out

This modification to your code for L6 allows the user to enter the total
quantiry
to increase L6, and that quantity will then be automatically added to I38 of
sheet 1.
The question arises, however, of why you do not simply add the quantity to
I38 to begin with? Also, why is it incremented on 1 at a time in the
original code? With more explanation, maybe a better solution can be
provided.


Sub Production15()
Dim addRng As Long
With Sheet2 ' Changer to suit
If .Range("L6").Value < "" Then ' Change L6 to suit
addRng = Application.InputBox("ENTER A QUANTITY TO ADD TO L6", _
"QUANTITY TO ADD", Type:=1)
..Range("L6") = addRange
End If
End With
Sheets("Sheet1").Range("I38") = Sheets("Sheet1").Range("I38") .Value _
+ Sheets("Sheet2").Range("L6").Value
Sheets("Sheet2").Range("L6") = 0
End Sub




"LiAD" wrote:

Hi,

I have four macros on two different excel sheets all controlling a value in
the same cell. On sheet 1 I have two macros which either add or subtract 1
from cell I38 every time the button is pushed. On sheet 2 I have another two
macros which do the same thing - they add and subtract 1 from cell L6.

I need cell L6 from sheet 2 to update the value in sheet 1 cell I38 then
reset to zero, but maintain the value in cell I38 sheet 1.

Example:
- I hit +1 five times and -1 twice on sheet 1. My stock, (cell I38 sheet
1), goes from 20 to 23.
- I then hit +1 ten times and -1 once on sheet 2. Cell L6 on sheet 2 will
show that I have entered a total of 9 times.
- Cell L6 will then update cell I38 on sheet 1 from 23 to 32.
- Cell L6 sheet 2 will reset to zero and cell I38 sheet 1 will stay at 32
until the next update arrives.

Is this possible? I have attached the +1 macro i am using below for
reference - maybe i need something different to do all the operations.

Thanks for your help

Sub Production15()
With Sheet2 ' Changer to suit
If Range("L6").Value < "" Then ' Change L6 to suit
Range("L6").Value = Range("L6").Value + 1
End If
End With
End Sub

Thanks

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 386
Default 4 Macro inputs, 1 out

Seems weird to have to inputs I agree. The reason is they will be done by
two different people, one like a supplier and the other a customer if you
want. If I put them all together on one sheet there will be a big risk that
they will get confused.

I would like to keep the macro incrementing 1 at a time in all cases - keeps
things simpler. The macros for the 1 increments I've got its just the
question of adding L6 sheet 2 to I38 sheet 1 and resetting L6 to zero five
minutes after the last input was entered.

Thanks

"JLGWhiz" wrote:

This modification to your code for L6 allows the user to enter the total
quantiry
to increase L6, and that quantity will then be automatically added to I38 of
sheet 1.
The question arises, however, of why you do not simply add the quantity to
I38 to begin with? Also, why is it incremented on 1 at a time in the
original code? With more explanation, maybe a better solution can be
provided.


Sub Production15()
Dim addRng As Long
With Sheet2 ' Changer to suit
If .Range("L6").Value < "" Then ' Change L6 to suit
addRng = Application.InputBox("ENTER A QUANTITY TO ADD TO L6", _
"QUANTITY TO ADD", Type:=1)
.Range("L6") = addRange
End If
End With
Sheets("Sheet1").Range("I38") = Sheets("Sheet1").Range("I38") .Value _
+ Sheets("Sheet2").Range("L6").Value
Sheets("Sheet2").Range("L6") = 0
End Sub




"LiAD" wrote:

Hi,

I have four macros on two different excel sheets all controlling a value in
the same cell. On sheet 1 I have two macros which either add or subtract 1
from cell I38 every time the button is pushed. On sheet 2 I have another two
macros which do the same thing - they add and subtract 1 from cell L6.

I need cell L6 from sheet 2 to update the value in sheet 1 cell I38 then
reset to zero, but maintain the value in cell I38 sheet 1.

Example:
- I hit +1 five times and -1 twice on sheet 1. My stock, (cell I38 sheet
1), goes from 20 to 23.
- I then hit +1 ten times and -1 once on sheet 2. Cell L6 on sheet 2 will
show that I have entered a total of 9 times.
- Cell L6 will then update cell I38 on sheet 1 from 23 to 32.
- Cell L6 sheet 2 will reset to zero and cell I38 sheet 1 will stay at 32
until the next update arrives.

Is this possible? I have attached the +1 macro i am using below for
reference - maybe i need something different to do all the operations.

Thanks for your help

Sub Production15()
With Sheet2 ' Changer to suit
If Range("L6").Value < "" Then ' Change L6 to suit
Range("L6").Value = Range("L6").Value + 1
End If
End With
End Sub

Thanks

Reply
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
clear inputs macro unhide all columns[_2_] Excel Discussion (Misc queries) 5 April 26th 10 10:59 PM
Quarterly inputs Loadmaster Excel Worksheet Functions 2 August 28th 09 03:22 PM
Can we modify the macro to accept multi-inputs? J_J Excel Programming 1 January 10th 05 10:22 AM
Inputs. Steven. Excel Programming 4 August 18th 04 01:12 PM
userform inputs Jouni Excel Programming 0 September 19th 03 10:51 PM


All times are GMT +1. The time now is 04:15 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"