How to increase or decrease the value of a worksheet cell automatically

Home More Videos

I need some Excel VBA help. I have a simple spreadsheet with a number in cell D2. I want to move a number up and down in value by pressing a button. The value of D2 is set to 1. Now I wish to press a button so that it becomes 2, 3 4, 5, etc. on every click. I would like to click on another button and make the value less by one. So if the value is 5 it becomes 4 on click and so on. I've searched everywhere but couldn't find a solution. Can you help me please?
Evan

You can increase or decrease the worksheet cell value by using appropriately coded command buttons as shown in the MS Excel training video below:





The macro code for the 'add' and 'minus' buttons is given below:

Private Sub CommandButton1_Click()
Range("D2").Value = Range("D2").Value + 1
End Sub

Private Sub CommandButton2_Click()
Range("D2").Value = Range("D2").Value - 1
End Sub

Watch the video on youtube