I am creating an inventory/stock control sheet for a client.
They have 100-130 items they want to run a stick control on. Then once they have the starting numbers they want two buttons on each row, one to increase the Qty and the other to decrease the Qty by 1.
So far I have created the first Increase and Decrease macros, then copy pasted, adjusted for the next row. Then I have added 2 buttons from the control box and assigned the appropriate macro to each box. Tested and each button works as intended.
My question is this... is there a quicker way to do this so that I don't have to replicate the below code over 100 times? I am going to have to create the buttons and assign the macros but I was hoping there was an easier way... eg... If I click on the quantity, for example cell B34, the increase button is then assigned to B34 so if I click it, the value in B34 increases by 1, without impacting the other numbers?
So, I'd have 100-130 rows. A= Item Desc, B=Qty (starting at row 3) - two buttons, one for increase, one for decrease. I click into B34, click Increase button and the Qty in B34 increases by 1.
The code I have for the first 2 rows is:
They have 100-130 items they want to run a stick control on. Then once they have the starting numbers they want two buttons on each row, one to increase the Qty and the other to decrease the Qty by 1.
So far I have created the first Increase and Decrease macros, then copy pasted, adjusted for the next row. Then I have added 2 buttons from the control box and assigned the appropriate macro to each box. Tested and each button works as intended.
My question is this... is there a quicker way to do this so that I don't have to replicate the below code over 100 times? I am going to have to create the buttons and assign the macros but I was hoping there was an easier way... eg... If I click on the quantity, for example cell B34, the increase button is then assigned to B34 so if I click it, the value in B34 increases by 1, without impacting the other numbers?
So, I'd have 100-130 rows. A= Item Desc, B=Qty (starting at row 3) - two buttons, one for increase, one for decrease. I click into B34, click Increase button and the Qty in B34 increases by 1.
The code I have for the first 2 rows is:
Code:
Sub CellB3incr()'
' Increase contents of cell by 1 per click
'
Range("B3").Select
Range("B3").Value = Range("B3").Value + 1
End Sub
Sub CellB3decr()
'
' Decrease contents of cell by 1 per click
'
Range("B3").Select
Range("B3").Value = Range("B3").Value - 1
End Sub
Sub CellB4incr()
'
' Increase contents of cell by 1 per click
'
Range("B4").Select
Range("B4").Value = Range("B4").Value + 1
End Sub
Sub CellB4decr()
'
' Decrease contents of cell by 1 per click
'
Range("B4").Select
Range("B4").Value = Range("B4").Value - 1
End Sub