• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 416
  • Last Modified:

Excel VBA read text from calling button

I have a sheet with multiple buttons.
If I press this button a macro is invoked (the macro was assigned to every button).
I need to read the text of the button into a variable.
How do I do this? is has to be the text from the button that is pushed to call the macro.

Kind regards

Eric
0
Eric Zwiekhorst
Asked:
Eric Zwiekhorst
1 Solution
 
Rory ArchibaldCommented:
Activesheet.Buttons(Application.Caller).Caption

will return the text.
0
 
Shanan212Commented:
you could assign

Dim temp as string

temp = Application.Caller

Open in new window


^ that would return the button name that was pressed to call the macro
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: C++ 11 Fundamentals

This course will introduce you to C++ 11 and teach you about syntax fundamentals.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now