Button that knows where it is...

smyers

New Member
Joined
Mar 5, 2009
Messages
4
Can I make a button that knows which row it is in?

I have a table and I'd like the last column to have a button which I can press to export the data on that specific row to a form. There are over 400 rows and I don't want to code each button seperately, but rather make a button for each row by simply doing a corner drag in design mode. Is this possible?

Oh, I also need to be able to sort the table and keep the button next to it's specific row. Thanks for the expert help. I appreciate it!
 
Last edited:

Excel Facts

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.
Don't know if you've tried this, but what I do when I want a bunch of buttons to run the same code, is use a drawing object. Try it... make your "button", assign the macro to it, and then just grab the cell and drag it. Set attributes first, though, since you will be running the same code on every button, no need to have each button follow the rows during a sort. Except for "don't move or size with cells." Do this one after you do the drag copy, just select all the objects at once and then set that attribute. Then when you do your sort, the button(s) will all stay where you had 'em.

There ya have it, an identical button that runs the same code, already assigned, without the hassle of coding each button separately. There may be someone on the board that knows how to code a bunch of buttons at once...

HTH,
XLXRider.
 
Upvote 0
An alternative may be to use a double-click event in the last cell of each row, perhaps with a little text to tell the user what to do:
book1
ABCD
1123DoubleClickHereToExportThisRow
2678DoubleClickHereToExportThisRow
3111213DoubleClickHereToExportThisRow
4161718DoubleClickHereToExportThisRow
5212223DoubleClickHereToExportThisRow
Sheet1
 
Upvote 0
In response to Alexander Barnes suggestion, this post contains some code that I've pieced together with a little help from the forums.

http://www.mrexcel.com/forum/showpost.php?p=1832377&postcount=4

Code is written to hide / show rows as selected using a hyperlink in cell, should be easy to modify for what you need to do.

Also 3rd block of code will create hyperlinks for you using existing cell content, all you have to do is set the range.

Hope this helps
 
Upvote 0
How do I do this? I am unfamiliar with "double-click events". I am intrigued by the possibilities, though. Thanks for the help.
 
Upvote 0

Forum statistics

Threads
1,214,522
Messages
6,120,022
Members
448,939
Latest member
Leon Leenders

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top