Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1867900
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T06:37:10+00:00 2026-05-17T06:37:10+00:00

I have assigned macro to few buttons. How can I find out inside macro

  • 0

I have assigned macro to few buttons.

How can I find out inside macro which button was clicked?

I am doing as user form, where he can input peoples from family:

name1:
surname1:

name2:
surname2:
|add next member|

I wish button to appear always in last row of the last added person.
For simplicity I think it is better to have like 100 empty forms in the
sheet but all invisible at the begining.
Then when user clicks add next member I simply make next rows visible,
and move button to next person. But to do that I need to know my current position.

Similar with deletion I would make rows invisible when remove button is clicked.

name1:
surname1:
[remove]

name2:
surname2:
[remove]

name3:
surname3:
|add next member|

I need to know which remove button was clicked.

EDIT:
Found in web – what do you think, seems to be best /way

Dim r As Range
Set r = ActiveSheet.Buttons(Application.Caller).TopLeftCell
Range(Cells(r.Row, r.Column), Cells(r.Row, r.Column)).Select
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T06:37:11+00:00Added an answer on May 17, 2026 at 6:37 am

    I always write wrappers for each button that then call the macro in question.

    Like so:

    Public Sub StoreButton_Click()
    
      Call StoreTransValues(ActiveSheet)
    
    End Sub
    

    If you have only one button for any one page, you can just get the ActiveSheet property, and it will be the button on that page.


    Edit:

    Here’s the code to get and use the name of the calling button:

    Dim ButtonText As String
    
    ButtonText = Application.Caller
    
    ActiveSheet.Shapes(ButtonText).Delete
    

    You would use the .Move method to move the button.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a program which deliberately performs a divide by zero (and stores the
I am having some trouble with macros in my excel workbook. I have a
I have an excel workbook that is used to track tasks by project. Each
What source control products have a diff facility that ignores white space, braces, etc.,
I keep getting an error 1004 for this line in my VBA Macro Editor:
I've been trying to figure out why C++ is making me crazy typing NULL
I'm trying to do something a bit unusual... I have this class Foo :
In Excel 2003, when I change Series.Interior.ColorIndex to a value I need, it has
The simplest way to manipulate the GIL in Python C extensions is to use
Is there any easy/quick way to yank into vim's last search register (/)? From

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.