Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Hiding a Button


Hi,

Just wondering if anyone out there can help?

I have a formula in cell A1 and if this is true it puts a '1' in A1 o
and if false leaves this cell blank.

What I am after is... Should cell A1 contain a number 1 then I want
button to be showing be available to click. However, if this cel
contains anything else I want the button to be hidden.

Is this possible? If so, how?

Many thanks :cool

--
gatesheadthund
-----------------------------------------------------------------------
gatesheadthunde's Profile: http://www.excelforum.com/member.php...fo&userid=1053
View this thread: http://www.excelforum.com/showthread.php?threadid=46631

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,119
Default Hiding a Button

You can use the worksheet change and sheet activate events to detect the
value of Cell A1. Based on that you can either hide or enable/disable the
button (I perfer enable/disable as the user know it is there is is just
greyed out if it is disabled)

The button that you have... is it from the control toolbox or the forms
toolbar. control toolbox puts the code in the sheet, while forms toolbar
attaches to code written in a module. It makes a difference because you have
to be able to find the button in your code and the syntax is different
depending on the type of button.

Private Sub Worksheet_Activate()
If ActiveSheet.Range("A1") = 1 Then
MsgBox "Unhide the button"
Else
MsgBox "Hide the button"
End If
End Sub

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$A$1" And Target.Value = 1 Then
MsgBox "Unhide the button"
Else
MsgBox "Hide the button"
End If
End Sub
--
HTH...

Jim Thomlinson


"gatesheadthunde" wrote:


Hi,

Just wondering if anyone out there can help?

I have a formula in cell A1 and if this is true it puts a '1' in A1 or
and if false leaves this cell blank.

What I am after is... Should cell A1 contain a number 1 then I want a
button to be showing be available to click. However, if this cell
contains anything else I want the button to be hidden.

Is this possible? If so, how?

Many thanks


--
gatesheadthunde
------------------------------------------------------------------------
gatesheadthunde's Profile: http://www.excelforum.com/member.php...o&userid=10536
View this thread: http://www.excelforum.com/showthread...hreadid=466312


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 201
Default Hiding a Button

Jim,

How do you actually enable or disable a button?

--
Trefor


"Jim Thomlinson" wrote:

You can use the worksheet change and sheet activate events to detect the
value of Cell A1. Based on that you can either hide or enable/disable the
button (I perfer enable/disable as the user know it is there is is just
greyed out if it is disabled)

The button that you have... is it from the control toolbox or the forms
toolbar. control toolbox puts the code in the sheet, while forms toolbar
attaches to code written in a module. It makes a difference because you have
to be able to find the button in your code and the syntax is different
depending on the type of button.

Private Sub Worksheet_Activate()
If ActiveSheet.Range("A1") = 1 Then
MsgBox "Unhide the button"
Else
MsgBox "Hide the button"
End If
End Sub

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$A$1" And Target.Value = 1 Then
MsgBox "Unhide the button"
Else
MsgBox "Hide the button"
End If
End Sub
--
HTH...

Jim Thomlinson


"gatesheadthunde" wrote:


Hi,

Just wondering if anyone out there can help?

I have a formula in cell A1 and if this is true it puts a '1' in A1 or
and if false leaves this cell blank.

What I am after is... Should cell A1 contain a number 1 then I want a
button to be showing be available to click. However, if this cell
contains anything else I want the button to be hidden.

Is this possible? If so, how?

Many thanks


--
gatesheadthunde
------------------------------------------------------------------------
gatesheadthunde's Profile: http://www.excelforum.com/member.php...o&userid=10536
View this thread: http://www.excelforum.com/showthread...hreadid=466312


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default Hiding a Button

There is an Enabled Property for command buttons. Select the button and
click the properties button on the control box toolbar, look under Enabled.

Or
myBar.Enabled = False
From VBA

Check out help and look at the object browser under CommandButton

I am not sure if this is what you were looking for.

Sean.


"Trefor" wrote in message
...
Jim,

How do you actually enable or disable a button?

--
Trefor


"Jim Thomlinson" wrote:

You can use the worksheet change and sheet activate events to detect the
value of Cell A1. Based on that you can either hide or enable/disable the
button (I perfer enable/disable as the user know it is there is is just
greyed out if it is disabled)

The button that you have... is it from the control toolbox or the forms
toolbar. control toolbox puts the code in the sheet, while forms toolbar
attaches to code written in a module. It makes a difference because you
have
to be able to find the button in your code and the syntax is different
depending on the type of button.

Private Sub Worksheet_Activate()
If ActiveSheet.Range("A1") = 1 Then
MsgBox "Unhide the button"
Else
MsgBox "Hide the button"
End If
End Sub

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$A$1" And Target.Value = 1 Then
MsgBox "Unhide the button"
Else
MsgBox "Hide the button"
End If
End Sub
--
HTH...

Jim Thomlinson


"gatesheadthunde" wrote:


Hi,

Just wondering if anyone out there can help?

I have a formula in cell A1 and if this is true it puts a '1' in A1 or
and if false leaves this cell blank.

What I am after is... Should cell A1 contain a number 1 then I want a
button to be showing be available to click. However, if this cell
contains anything else I want the button to be hidden.

Is this possible? If so, how?

Many thanks


--
gatesheadthunde
------------------------------------------------------------------------
gatesheadthunde's Profile:
http://www.excelforum.com/member.php...o&userid=10536
View this thread:
http://www.excelforum.com/showthread...hreadid=466312




  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 201
Default Hiding a Button

Sean,

Sorry I must be missing something here.

If I select the button, then through Control Toolbox I select properties, it
only seems to display the properties for the sheet not the button.

I used:

ActiveSheet.Shapes("Button 30").Visible = False

And this works in making it visible or not, but I would like to keep it
visible, but "greyed out" and disabled.

I thought the following might work:

ActiveSheet.Shapes("Button 30").Enabled = False

but Enabled is not valid.

Iand... I could not find this in Help.
--
Trefor


"Sean Bartleet" wrote:

There is an Enabled Property for command buttons. Select the button and
click the properties button on the control box toolbar, look under Enabled.

Or
myBar.Enabled = False
From VBA

Check out help and look at the object browser under CommandButton

I am not sure if this is what you were looking for.

Sean.


"Trefor" wrote in message
...
Jim,

How do you actually enable or disable a button?

--
Trefor


"Jim Thomlinson" wrote:

You can use the worksheet change and sheet activate events to detect the
value of Cell A1. Based on that you can either hide or enable/disable the
button (I perfer enable/disable as the user know it is there is is just
greyed out if it is disabled)

The button that you have... is it from the control toolbox or the forms
toolbar. control toolbox puts the code in the sheet, while forms toolbar
attaches to code written in a module. It makes a difference because you
have
to be able to find the button in your code and the syntax is different
depending on the type of button.

Private Sub Worksheet_Activate()
If ActiveSheet.Range("A1") = 1 Then
MsgBox "Unhide the button"
Else
MsgBox "Hide the button"
End If
End Sub

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$A$1" And Target.Value = 1 Then
MsgBox "Unhide the button"
Else
MsgBox "Hide the button"
End If
End Sub
--
HTH...

Jim Thomlinson


"gatesheadthunde" wrote:


Hi,

Just wondering if anyone out there can help?

I have a formula in cell A1 and if this is true it puts a '1' in A1 or
and if false leaves this cell blank.

What I am after is... Should cell A1 contain a number 1 then I want a
button to be showing be available to click. However, if this cell
contains anything else I want the button to be hidden.

Is this possible? If so, how?

Many thanks


--
gatesheadthunde
------------------------------------------------------------------------
gatesheadthunde's Profile:
http://www.excelforum.com/member.php...o&userid=10536
View this thread:
http://www.excelforum.com/showthread...hreadid=466312







  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 14
Default Hiding a Button

Try this:

You may have some other setting that is causing problems. I do not know
enough about this to suggest where to look.

Try this in a new instance of Excel:
Open excel, ensure your Control toolbox toolbar is visible (right click on
the menu and make sure Control toolbox is checked.
Enable the properties (click properties button)
The Worksheet will be selected as a default (I think that you have got this
far)
Create a command button (click command button on Control toolbar and click
somewhere in workbook)
Now click on the command button (the properties window should be listing the
properties for CommandButton1)

As for finding this in help try this:
From Microsoft visual basic click the object browser button on the standard
toolbar (looks like a box with some toys being thrown in)
Under classes select the commandbutton item.

Good luck.

Sean



"Trefor" wrote in message
...
Sean,

Sorry I must be missing something here.

If I select the button, then through Control Toolbox I select properties,
it
only seems to display the properties for the sheet not the button.

I used:

ActiveSheet.Shapes("Button 30").Visible = False

And this works in making it visible or not, but I would like to keep it
visible, but "greyed out" and disabled.

I thought the following might work:

ActiveSheet.Shapes("Button 30").Enabled = False

but Enabled is not valid.

Iand... I could not find this in Help.
--
Trefor


"Sean Bartleet" wrote:

There is an Enabled Property for command buttons. Select the button and
click the properties button on the control box toolbar, look under
Enabled.

Or
myBar.Enabled = False
From VBA

Check out help and look at the object browser under CommandButton

I am not sure if this is what you were looking for.

Sean.


"Trefor" wrote in message
...
Jim,

How do you actually enable or disable a button?

--
Trefor


"Jim Thomlinson" wrote:

You can use the worksheet change and sheet activate events to detect
the
value of Cell A1. Based on that you can either hide or enable/disable
the
button (I perfer enable/disable as the user know it is there is is
just
greyed out if it is disabled)

The button that you have... is it from the control toolbox or the
forms
toolbar. control toolbox puts the code in the sheet, while forms
toolbar
attaches to code written in a module. It makes a difference because
you
have
to be able to find the button in your code and the syntax is different
depending on the type of button.

Private Sub Worksheet_Activate()
If ActiveSheet.Range("A1") = 1 Then
MsgBox "Unhide the button"
Else
MsgBox "Hide the button"
End If
End Sub

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$A$1" And Target.Value = 1 Then
MsgBox "Unhide the button"
Else
MsgBox "Hide the button"
End If
End Sub
--
HTH...

Jim Thomlinson


"gatesheadthunde" wrote:


Hi,

Just wondering if anyone out there can help?

I have a formula in cell A1 and if this is true it puts a '1' in A1
or
and if false leaves this cell blank.

What I am after is... Should cell A1 contain a number 1 then I want
a
button to be showing be available to click. However, if this cell
contains anything else I want the button to be hidden.

Is this possible? If so, how?

Many thanks


--
gatesheadthunde
------------------------------------------------------------------------
gatesheadthunde's Profile:
http://www.excelforum.com/member.php...o&userid=10536
View this thread:
http://www.excelforum.com/showthread...hreadid=466312







Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
hiding cells then a button to show them again [email protected] Excel Discussion (Misc queries) 1 January 23rd 07 06:06 PM
Hiding a button when hiding rows fergusor Excel Discussion (Misc queries) 2 August 10th 06 02:31 PM
hiding forms button bigtonyicu Excel Discussion (Misc queries) 1 August 11th 05 11:00 PM
HIDING A BUTTON Glenn Excel Programming 3 May 10th 05 07:54 PM
Hiding A Sheet Command Button With VBA Minitman[_3_] Excel Programming 2 March 7th 04 01:16 AM


All times are GMT +1. The time now is 07:12 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"