PC Review


Reply
Thread Tools Rate Thread

disable macros in a worksheet

 
 
Gordon
Guest
Posts: n/a
 
      24th Sep 2008
Hi...

I have a workbook with 10 sheets with 15 buttons (with macros) per sheet. Is
it possible to enable/disable these buttons based on a a value entered in a
cell?

e.g. If the user enters a value into cell A1 he can begin to navigate the
workbook using the buttons/macros?

Someone must be clever out there.

Thanks

G
 
Reply With Quote
 
 
 
 
Jim Thomlinson
Guest
Posts: n/a
 
      24th Sep 2008
You need to add a validation routinte to each command button that checks the
value of cell A1. Depending on the value exit sub or continue. There is no
silver bullet on this one...
--
HTH...

Jim Thomlinson


"Gordon" wrote:

> Hi...
>
> I have a workbook with 10 sheets with 15 buttons (with macros) per sheet. Is
> it possible to enable/disable these buttons based on a a value entered in a
> cell?
>
> e.g. If the user enters a value into cell A1 he can begin to navigate the
> workbook using the buttons/macros?
>
> Someone must be clever out there.
>
> Thanks
>
> G

 
Reply With Quote
 
Gordon
Guest
Posts: n/a
 
      24th Sep 2008
Hi...Where do I find the validation option in the code settings for the
command button?

"Jim Thomlinson" wrote:

> You need to add a validation routinte to each command button that checks the
> value of cell A1. Depending on the value exit sub or continue. There is no
> silver bullet on this one...
> --
> HTH...
>
> Jim Thomlinson
>
>
> "Gordon" wrote:
>
> > Hi...
> >
> > I have a workbook with 10 sheets with 15 buttons (with macros) per sheet. Is
> > it possible to enable/disable these buttons based on a a value entered in a
> > cell?
> >
> > e.g. If the user enters a value into cell A1 he can begin to navigate the
> > workbook using the buttons/macros?
> >
> > Someone must be clever out there.
> >
> > Thanks
> >
> > G

 
Reply With Quote
 
Rick Rothstein
Guest
Posts: n/a
 
      24th Sep 2008
You did mean CommandButton when you said "button", right?

Which "buttons" did you use... the ones from Form's toolbar or the Control
Toolbox toolbar?

--
Rick (MVP - Excel)


"Gordon" <(E-Mail Removed)> wrote in message
news5E3D3C2-6499-4376-B0C7-(E-Mail Removed)...
> Hi...
>
> I have a workbook with 10 sheets with 15 buttons (with macros) per sheet.
> Is
> it possible to enable/disable these buttons based on a a value entered in
> a
> cell?
>
> e.g. If the user enters a value into cell A1 he can begin to navigate the
> workbook using the buttons/macros?
>
> Someone must be clever out there.
>
> Thanks
>
> G


 
Reply With Quote
 
Jim Thomlinson
Guest
Posts: n/a
 
      24th Sep 2008
You build it yourself

Private Sub CommandButton1_Click()
If Not IsGoodToGo Then Exit Sub
End Sub

Public Function IsGoodToGo() As Boolean
IsGoodToGo = False
If Range("A1").Value = "Something" Then IsGoodToGo = True
End Function

--
HTH...

Jim Thomlinson


"Gordon" wrote:

> Hi...Where do I find the validation option in the code settings for the
> command button?
>
> "Jim Thomlinson" wrote:
>
> > You need to add a validation routinte to each command button that checks the
> > value of cell A1. Depending on the value exit sub or continue. There is no
> > silver bullet on this one...
> > --
> > HTH...
> >
> > Jim Thomlinson
> >
> >
> > "Gordon" wrote:
> >
> > > Hi...
> > >
> > > I have a workbook with 10 sheets with 15 buttons (with macros) per sheet. Is
> > > it possible to enable/disable these buttons based on a a value entered in a
> > > cell?
> > >
> > > e.g. If the user enters a value into cell A1 he can begin to navigate the
> > > workbook using the buttons/macros?
> > >
> > > Someone must be clever out there.
> > >
> > > Thanks
> > >
> > > G

 
Reply With Quote
 
Orion Cochrane
Guest
Posts: n/a
 
      24th Sep 2008
I was able to do the following with CommandButton1 using Control Toolbox and
Sheet1 Object:
Private Sub CommandButton1_Click()
Range("A2").Value = "Cochrane"
End Sub
Private Sub Worksheet_Change(ByVal Target As Range)
If Range("A1").Value = "Orion" Then
CommandButton1.Enabled = True
Else: CommandButton1.Enabled = False
End If
End Sub

I tested it and it works. Substitute with your CommandButton1_Click actions.
--
I am running on Excel 2003, unless otherwise stated. Please rate posts so we
know when we have answered your questions. Thanks.


"Gordon" wrote:

> Hi...
>
> I have a workbook with 10 sheets with 15 buttons (with macros) per sheet. Is
> it possible to enable/disable these buttons based on a a value entered in a
> cell?
>
> e.g. If the user enters a value into cell A1 he can begin to navigate the
> workbook using the buttons/macros?
>
> Someone must be clever out there.
>
> Thanks
>
> G

 
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
Disable worksheet macros when copying a worksheet in VBA Craig Remillard Microsoft Excel Programming 2 11th Jan 2010 03:21 AM
Word & Enable Macros and Disable macros Theresa Microsoft Word Document Management 1 29th Sep 2008 10:38 PM
Removing Excel message to enable macros or disable macros =?Utf-8?B?Ym1pbGxlcjI2Mw==?= Microsoft Excel Misc 2 13th Oct 2004 02:39 PM
Doc has no macros, but I'm prompted to enable/disable macros Microsoft Word Document Management 2 7th Oct 2004 09:34 AM
Suppress the Disable Macros / Enable Macros Dialog Shoji Karai Microsoft Excel Programming 5 24th Sep 2003 03:10 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 04:45 AM.