-
can a macro determine button that invoked it?
I have a macro that performs a sort on a table given the column number to sort on. I assume there is some way that the macro can determine which button invoked the macro. That is what I'm looking for. "Who called me?"
I'm using a simple autoshape as the button. I want to drop the same button at the header to each column and have the macro determine which cell the bottom was in.
If I can get that much information I can also have ascending and descending buttons invoke the same macro and set the appropriate parameter in the sort.
-
-
I thought it would be something simple. Thanks.
-
-
Still trying
Joseph, I tried a few things with application.caller in the sub that was assigned to a shape. But didnt get what I wanted.
Application.caller by itself returns "Microsoft Excel". Nice but not what I am looking for. I have many copies of the same shape dropped in many different cells. Im trying to get the specific shape object so I can cell that it is tied to.
-
-
Well it must have been too late last night. Tonight I worked up a test sheet with a bunch of copies of a shape that had been assigned to a macro. The assignment copied with each instance. My macro did a quick scan of the shapes collection found the one named the same as application.caller and then was able to get the BottomRightCorner (row and column). I used other shapes and was able to identify the shapes of the button clicked. This gives me exactly what I want in my table sorting macro. Each column header can contain a ascending and descending shapes and I only need one macro to do all of them.
Thanks for staying with me Joseph.
Robin
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules