+ Reply to Thread
Results 1 to 5 of 5

How to reset controls on a form after declaring them "Nothing"

  1. #1
    Registered User
    Join Date
    11-03-2017
    Location
    St. John's Newfoundland
    MS-Off Ver
    2010
    Posts
    19

    How to reset controls on a form after declaring them "Nothing"

    Hello everyone, so I disabled my controls on the form "UserForm1" using the following code:

    Please Login or Register  to view this content.
    For reference, the following link is where I got the code from:
    https://stackoverflow.com/questions/...ble-all-fields

    However, when I go back to the UserForm1, none of the controls work anymore even when I put "ctrl.Enabled = True" in the code. What code do I need to use so the controls can have their normal functionality in UserForm1?

  2. #2
    Valued Forum Contributor ranman256's Avatar
    Join Date
    07-29-2012
    Location
    Kentucky
    MS-Off Ver
    Excel 2003
    Posts
    1,176

    Re: How to reset controls on a form after declaring them "Nothing"

    make it more versitile by giving a parameter to turn it on or off....
    usage: EnableCtrls TRUE

    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    11-03-2017
    Location
    St. John's Newfoundland
    MS-Off Ver
    2010
    Posts
    19

    Re: How to reset controls on a form after declaring them "Nothing"

    I'm not sure that would help, I have attached my code for a button associated with UserForm1 and the disable controls feature is activated upon clicking that button if the worksheet is protected.

    Please Login or Register  to view this content.
    If the sheet is not protected, it shouldn't run the disabling button code and the code I have in bold which re-enables the buttons should run, however when I try to use the button it still does not work and I don't know why.

  4. #4
    Forum Guru xlnitwit's Avatar
    Join Date
    06-27-2016
    Location
    London
    MS-Off Ver
    Windows: 2010; Mac: 16.13 (O365)
    Posts
    7,085

    Re: How to reset controls on a form after declaring them "Nothing"

    I think you want to move the Exit Sub line above the bold part so that it appears before the End If line.
    Don
    Please remember to mark your thread 'Solved' when appropriate.

  5. #5
    Registered User
    Join Date
    11-03-2017
    Location
    St. John's Newfoundland
    MS-Off Ver
    2010
    Posts
    19

    Re: How to reset controls on a form after declaring them "Nothing"

    Ah, that was the problem... can't believe I missed that. Thanks for your help.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. CommandBars("Worksheet Menu Bar").Controls("Tools").Enabled = Fals
    By Arturo in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 02-06-2015, 05:43 AM
  2. [SOLVED] Compile Error - "Expected array "- when declaring a string variable??
    By wazimu13 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 12-09-2013, 03:20 PM
  3. "Form and macro" to delete "Active" cell contents.
    By wanty in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-22-2013, 11:33 PM
  4. SUMIFS Function To Reset SUM if "x" is placed to "0" ??
    By Exceldummy101 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 01-15-2013, 04:45 PM
  5. Replies: 2
    Last Post: 11-16-2012, 04:35 AM
  6. Replies: 3
    Last Post: 04-24-2006, 01:35 PM
  7. [SOLVED] Urgently need VB Help - Declaring "Global" Variable?
    By April in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-18-2005, 10:06 AM

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