Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 I don't know. 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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Maybe something like:
Sub NewMacro1() 'reset L6 to 0 Sheet2.range("L6").value = 0 'Add 1 to I38 with Sheet1 if isnumeric(.range("I38").value) then .range("I38").value = .range("i38") + 1 else msgbox "I38 on sheet1 isn't a number!" end if end with End Sub I don't see why you'd want to increment L6 if you're going to set it to 0 when you're done. I'd just set it to 0. 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 I don't know. 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 -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
clear inputs macro | Excel Discussion (Misc queries) | |||
4 Macro inputs, 1 out | Excel Programming | |||
summing multi inputs | Excel Programming | |||
Multi Macro | Excel Discussion (Misc queries) | |||
Can we modify the macro to accept multi-inputs? | Excel Programming |