Quick solution for 400 increment macro's with VBA?

ienimieni

New Member
Joined
Feb 17, 2021
Messages
1
Office Version
  1. 2019
Platform
  1. Windows
Hello community,

Excel/macro noob here. I have a question. currently i am working on a 'barman list' in excel where the barman can click the + and the - to increment or decrement a value. For examle, "john" orders a drink, the barman clicks the + button behind his name and a 1 will appear. I have around 40 people that need to be on the list, x 4 the types of drinks and snacks. This is a huge job if i need to make a seperate VBA macro for each thing (40 x 8 = 320 !!)

Is there a way to make this way quicker?

Photo of example here:

1613599320906.png


The + and the - is a shape with a macro connected to it (only at the first row are macro's connected, obviously).

I hope you can help! Thanks!


- Rob
 

Excel Facts

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.
Hi & welcome to MrExcel.
You could something like this for all the + shapes
VBA Code:
Sub ienimieni()
   With ActiveSheet.Shapes(Application.Caller).TopLeftCell.Offset(, -1)
      .Value = .Value + 1
   End With
End Sub
 
Upvote 0
I wouldn't use shapes or macros at all for something like this. Go to the Developer tab. (If you don't have it visible, go to File > Options > Customize Ribbon > and check the Developer box on the right.) Then go to Insert > Spin Button (form control). Use the mouse to paint it on the sheet where you want it. Then right click it > Format Control > Control tab > and set the Cell link to where you want the value to go.
 
Upvote 0
or you could also make a userform and employ spinbuttons. same idea really
 
Upvote 0

Forum statistics

Threads
1,215,045
Messages
6,122,836
Members
449,096
Latest member
Erald

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