Excel Active X Single Button VBA

theodosis

New Member
Joined
Apr 6, 2021
Messages
2
Office Version
  1. 2013
Platform
  1. Windows
I hope there will be someone that can help with my question. I am trying to update the inventory of a specific product by using excel and the developer section commands. Thus I need t use a single button named as "add / subtract" in order to add or subtract a value of 1. I need to choose the part's icon and then by selecting these buttons to control its quantity. Please see the reference below:

By selecting the part in need, I want to hit the here button. This will select the actual barcode of the item and will display it in the text box above it. Then I want to hit the plus or minus buttons to change the part's quantity. Up to this point I have been able to use simple commands in VBA to update the value of a specific cell. I am in need though to try to find a linked command that will "hold" the current value of inventory and then will add or subtract a value of 1. I know the road to do this is the ActiveCell command but i don't want to use the actual value of inventory of a part. I want to select a part and link its current value as soon as i hit the here button.

Right up to this point I have reached the following level:

Private Sub CommandButton2_Click()
Me.Range("I5").Value = Me.Range("I5").Value + 1
End Sub

Private Sub CommandButton1_Click()
Me.TextBox1.Value = Selection
End Sub

Private Sub CommandButton3_Click()
Me.Range("I5").Value = Me.Range("I5").Value - 1
End Sub

These lines are connected with the updated value of a prespecified cell. The function in the middle "prints" a selected value into the textbox. How am i supposed to update the used parts cell (eg. cell I5), while selecting from the start the part in need, (eg. cell A5)? These lines are completely independent to each other.

Please, any suggestions would be much appreciated.

EDIT
Incorrect image removed
 
Last edited by a moderator:

Excel Facts

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)
Sorry for the image above. The correct one is the following one:
 

Attachments

  • Screenshot_1.png
    Screenshot_1.png
    100.1 KB · Views: 14
Upvote 0

Forum statistics

Threads
1,223,243
Messages
6,170,967
Members
452,371
Latest member
Frana

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top