PC Review


Reply
Thread Tools Rate Thread

Button on a sheet

 
 
ranswrt
Guest
Posts: n/a
 
      7th Aug 2008
Is there a way to set a button on a worksheet to enable = false like with a
commandbutton on a userform? Will the text lighten to show that it is
disabled?
 
Reply With Quote
 
 
 
 
Rick Rothstein \(MVP - VB\)
Guest
Posts: n/a
 
      7th Aug 2008
If the button on the worksheet was an ActiveX button control from the
Control Toolbox toolbar, then you could put this in the UserForm's
CommandButton's Click event...

Worksheets("Sheet1").CommandButton1.Enabled = False

Change the worksheet reference and name of the button on the worksheet to
match your actual conditions.

Rick


"ranswrt" <(E-Mail Removed)> wrote in message
news:FDA30679-6F92-42EA-B3B8-(E-Mail Removed)...
> Is there a way to set a button on a worksheet to enable = false like with
> a
> commandbutton on a userform? Will the text lighten to show that it is
> disabled?


 
Reply With Quote
 
ranswrt
Guest
Posts: n/a
 
      7th Aug 2008
It was put on with the forms toolbar.

"Rick Rothstein (MVP - VB)" wrote:

> If the button on the worksheet was an ActiveX button control from the
> Control Toolbox toolbar, then you could put this in the UserForm's
> CommandButton's Click event...
>
> Worksheets("Sheet1").CommandButton1.Enabled = False
>
> Change the worksheet reference and name of the button on the worksheet to
> match your actual conditions.
>
> Rick
>
>
> "ranswrt" <(E-Mail Removed)> wrote in message
> news:FDA30679-6F92-42EA-B3B8-(E-Mail Removed)...
> > Is there a way to set a button on a worksheet to enable = false like with
> > a
> > commandbutton on a userform? Will the text lighten to show that it is
> > disabled?

>
>

 
Reply With Quote
 
Rick Rothstein \(MVP - VB\)
Guest
Posts: n/a
 
      7th Aug 2008
I think there is a direct way to do what you want with that type of button,
but this kludge method seems to work as a substitute. Put this code line in
the Click event for the CommandButton on your UserForm...

Worksheets("Sheet1").Shapes("Button 1").TextFrame. _
Characters.Font.ColorIndex = 15

Change the worksheet reference and button name to those for your own
condition. Okay, that will change the button's font color to gray. Now, put
this line as the **FIRST** line in the macro assigned to the button

If Sheet1Shapes("Button 1").TextFrame.Characters. _
Font.ColorIndex = 15 Then Exit Sub

Again, change the worksheet reference and button name to those for your own
condition. If the button's font color is color index 15, the assigned macro
will exit before any code is executed... if the color index is any other
value, the macro code will run normally. This duplicates what happens when a
control is disabled and should suffice for your needs.

Rick


"ranswrt" <(E-Mail Removed)> wrote in message
news:433BACB0-B2AC-476E-B980-(E-Mail Removed)...
> It was put on with the forms toolbar.
>
> "Rick Rothstein (MVP - VB)" wrote:
>
>> If the button on the worksheet was an ActiveX button control from the
>> Control Toolbox toolbar, then you could put this in the UserForm's
>> CommandButton's Click event...
>>
>> Worksheets("Sheet1").CommandButton1.Enabled = False
>>
>> Change the worksheet reference and name of the button on the worksheet to
>> match your actual conditions.
>>
>> Rick
>>
>>
>> "ranswrt" <(E-Mail Removed)> wrote in message
>> news:FDA30679-6F92-42EA-B3B8-(E-Mail Removed)...
>> > Is there a way to set a button on a worksheet to enable = false like
>> > with
>> > a
>> > commandbutton on a userform? Will the text lighten to show that it is
>> > disabled?

>>
>>


 
Reply With Quote
 
Rick Rothstein \(MVP - VB\)
Guest
Posts: n/a
 
      7th Aug 2008
>I think there is a direct way to do what you want with that type of button,

That was supposed to say "I **DO NOT** think there is a direct way...

Rick

 
Reply With Quote
 
randy
Guest
Posts: n/a
 
      7th Aug 2008
Thanks I think I will switch the buttons to a control button from the toolbox
toolbar.
That seems alot easier.

"Rick Rothstein (MVP - VB)" wrote:

> >I think there is a direct way to do what you want with that type of button,

>
> That was supposed to say "I **DO NOT** think there is a direct way...
>
> Rick
>
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Button do not appear on Sheet ! Amit Microsoft Excel Programming 0 19th Dec 2006 07:45 PM
Button to copy sheet, rename sheet sequencially. foxgguy2005 Microsoft Excel Programming 9 17th Jun 2005 01:41 PM
How do I create a command button to jump from sheet to sheet in a. =?Utf-8?B?RGFybGVuZXc=?= Microsoft Excel Worksheet Functions 3 22nd Mar 2005 10:36 PM
Re: button in sheet Tom Ogilvy Microsoft Excel Programming 0 28th Jul 2004 03:08 PM
Pause macro, add form button to sheet, continue macro when button clicked! Flystar Microsoft Excel Programming 1 26th May 2004 09:45 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:46 PM.