Letting buttons depend on the sheet?

G

Gustaf

I'm using Excel 2007. I wonder if it's possible with VBA to have different buttons appear for different sheets? That is, when I go from one sheet to another, some buttons shall disappear and some shall appear, so that only the set of buttons relevant to the active sheet is visible. If this is not possible, are there other ways to achieve something similar?

Gustaf
 
G

Gustaf

Gustaf said:
I'm using Excel 2007. I wonder if it's possible with VBA to have
different buttons appear for different sheets? That is, when I go from
one sheet to another, some buttons shall disappear and some shall
appear, so that only the set of buttons relevant to the active sheet is
visible. If this is not possible, are there other ways to achieve
something similar?

Just to clarify, I'm talking about toolbar buttons that activate custom VBA macros.

Gustaf
 
J

Jim Rech

Excel 2007 doesn't have toolbar buttons so I presume you're talking about
adding custom buttons to the ribbon, either a build-in tab or a custom tab.
Having such buttons appear and disappear when switching worksheets would
take a combination of RibbonX and VBA. If you've already build your ribbonx
you'd just have to use the getVisible callback to return the current visible
state when the ribbon is invalidated. And you'd have to invalidate the
ribbon with the sheet activate or deactivate event.

If you're not all that familiar with customizing the ribbon you can either
drive into it or, if you haven't got the time, maybe you could just insert
buttons from the Developer tab directly on the worksheets and hook your
macros to them.

--
Jim
| Gustaf wrote:
| > I'm using Excel 2007. I wonder if it's possible with VBA to have
| > different buttons appear for different sheets? That is, when I go from
| > one sheet to another, some buttons shall disappear and some shall
| > appear, so that only the set of buttons relevant to the active sheet is
| > visible. If this is not possible, are there other ways to achieve
| > something similar?
|
| Just to clarify, I'm talking about toolbar buttons that activate custom
VBA macros.
|
| Gustaf
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top