Results 1 to 2 of 2

Disabling buttons on worksheets using vba

This is a discussion on Disabling buttons on worksheets using vba within the Excel Questions forums, part of the Question Forums category; Hi there, Can anyone help me I wish to disable some buttons on a worksheet so to guide the user ...

  1. #1
    New Member
    Join Date
    Sep 2002
    Posts
    13

    Default Disabling buttons on worksheets using vba

    Hi there,

    Can anyone help me I wish to disable some buttons on a worksheet so to guide the user around the page step by step can anyone help me with the referencing of the button

    i.e Worksheet("Main Menu").cmdButton.enabled = False

    Cheers

  2. #2
    Board Regular
    Join Date
    Nov 2003
    Posts
    230

    Default Re: Disabling buttons on worksheets using vba

    Hey redbull8vodka

    The correct code would be :

    Code:
    Sheets("Main Menu").CommandButton.Enabled = False
    where NumberHere represents the actual CommandButton number.

    You can also loop through the controls and disable all those command buttons that are not named "Whatever" using the CmdButton control type i.e

    Code:
    For Each ctl in Controls
    If ctl.Type = CmdButton Then
    If ctl.Name <> CommandButton1 Then
    ctl.Enabled = False
    End If
    End If
    Next ctl
    Try That

    anvil19
    :o

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


DMCA.com