So I was wondering if I can reference the button that was clicked. So I do not have to change the code to much for every button. So here is what I have.
Private
The answer in this SO post solves your issue.
Follow the instructions carefully. It should solve your problem. :)
EDIT:
It's pretty easy, actually.
SCREENSHOTS:
Set-up of my sheet:
Set-up of the VBE, Sheet1's code:
NOTE THE HIGHLIGHTED PARTS!
Set-up of the VBE, Class Module:
Add a class module by inserting Class Module
rather than just Module
. The name should exactly be ButtonEvents
.
Result when CommandButton1 is clicked:
===============
This is just the basic premise, of course. Instead of showing a message box, you can instead change the code in the class module to have the name stored somewhere or send it to a particular cell, etc.
Hope this makes it clearer.