All,
I have a spreadsheet of say 1000 columns split into groups of 25. The first of each group simply sums the rows of the other 24 cols. We will call the 1st col of each 25 the primary col whilst all the other are secondary.
If I put a toggle button at the top of the primary column, I can by linking this to the same cell use a macro to hide / unhide all the secondary columns tied to the primary column. This works
But there are approx 50 buttons required all with apart from the name and the function that returns the position of the linked cell identical macros. If I copy a button the copy remains linked to the same cell as the master button and there is a blank macro associated with it.
Option 1: Create 50 buttons, macros manually - boring
Option 2: Create 50 buttons with identical macros all of which pass parameters to a master macro that does the hiding etc. However this relies on one of two things:
a. Each button has to be manually linked to a cell - so the ActiveCell.Column returns the column that the button is in. I could then use the position of the button to define which is the primary column and then hide the next 24 columns
b. Manually edit each button with a linked cell
What I would like to do is copy and paste the buttons and then use something to get the position of the button, rather than any linked cell. I can generate the short stub macros easily that just pass parameters to the primary macro.
Any ideas how to persuade a button to return its current column location when its cliicked, without having to link a cell or anything custom?
Regards
Sean
Bookmarks