ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Command Button Created from Forms Menu Question (https://www.excelbanter.com/excel-programming/370779-command-button-created-forms-menu-question.html)

JR_06062005[_2_]

Command Button Created from Forms Menu Question
 
I've created a spreadsheet that has several views with several buttons (to do
various things) which I created using the Forms Menu Bar. One thing I would
like to be able to do is make some of the buttons invisible for certain
views. If anyone knows how I can do this, I would certainly appreciate the
help.

Muhammed Rafeek M

Command Button Created from Forms Menu Question
 
use this commend:
ActiveSheet.Shapes("Button 1").Visible = False
or
ActiveSheet.Shapes(1).Visible = False

"JR_06062005" wrote:

I've created a spreadsheet that has several views with several buttons (to do
various things) which I created using the Forms Menu Bar. One thing I would
like to be able to do is make some of the buttons invisible for certain
views. If anyone knows how I can do this, I would certainly appreciate the
help.


JR_06062005[_2_]

Command Button Created from Forms Menu Question
 
Thanks so much for your response. I discovered, by hit and miss, a slightly
different approach, which I would like to share with anyone else wishing to
hide a button created from the Forms Menu:

Run the code code below until the button you want is selected:

WorkSheets(1).Shapes.Items(i).select

Where i = a number starting with 1

That provides the item # to identify the button. Then run the code below to
make the button invisible:

WorkSheets(1).Shapes.Items(#).Visible=msoFalse

Where # is the number of the item you discovered

You probably can use this code with the ActiveSheet member as opposed to the
WorkSheet class, but I haven't test it.

"Muhammed Rafeek M" wrote:

use this commend:
ActiveSheet.Shapes("Button 1").Visible = False
or
ActiveSheet.Shapes(1).Visible = False

"JR_06062005" wrote:

I've created a spreadsheet that has several views with several buttons (to do
various things) which I created using the Forms Menu Bar. One thing I would
like to be able to do is make some of the buttons invisible for certain
views. If anyone knows how I can do this, I would certainly appreciate the
help.



All times are GMT +1. The time now is 05:09 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com