+ Reply to Thread
Results 1 to 6 of 6

how to lock a range of buttons when a main button is pressed in vba

  1. #1
    Registered User
    Join Date
    02-12-2013
    Location
    England
    MS-Off Ver
    Excel 2010
    Posts
    68

    how to lock a range of buttons when a main button is pressed in vba

    Hi everyone,

    Just wondering if it is possible to lock a range of buttons that have similar names when a main button is pressed in VBA, so that the user can not press these button after the main button is pressed. ...

  2. #2
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: how to lock a range of buttons when a main button is pressed in vba

    Hi jake,

    You've got to disable the buttons too:

    Please Login or Register  to view this content.
    (You may have to reverse the order - this code isn't tested)
    If I've helped you, please consider adding to my reputation - just click on the liitle star at the left.

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~(Pride has no aftertaste.)

    You can't do one thing. XLAdept

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~aka Orrin

  3. #3
    Registered User
    Join Date
    02-12-2013
    Location
    England
    MS-Off Ver
    Excel 2010
    Posts
    68

    Re: how to lock a range of buttons when a main button is pressed in vba

    Thanks you this works, but is it possible to lock a number of buttons at the same time just by using one line of code, if the buttons all have similar names. for example I have a buttons called cmdSeat1 ranging to cmdSeat197, there are 197 in total. all with similar names, only difference being is the number within the name such as cmdSeat45 or cmdSeat67. Is it possible to lock them all at once using only one line of code.

  4. #4
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: how to lock a range of buttons when a main button is pressed in vba

    You could use:

    Please Login or Register  to view this content.
    or something similar fr if Ctl.Name Like *Seat* etc

  5. #5
    Registered User
    Join Date
    02-12-2013
    Location
    England
    MS-Off Ver
    Excel 2010
    Posts
    68

    Re: how to lock a range of buttons when a main button is pressed in vba

    I've solved it now but thanks for the help !!!

  6. #6
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: how to lock a range of buttons when a main button is pressed in vba

    You're welcome!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1