I think I see your problem!
Your original workbook contained the code :
Now, when you try to assign a routine to a button, the FUNCTION will not appear in the list of available macros (because it's not a "Sub" procedure), and the SUB will not appear because it's been declared as "Private".
So, either declare the SUB as a "Public" procedure, or (better!) convert the FUNCTION to a "Public Sub" procedure. Just use:
The "End Function" statement will be converted automatically to "End Sub".
This should allow the procedure to appear in the list of available macros so that you can assign it to whichever object you want.
Please let me know how you get on with this.