+ Reply to Thread
Results 1 to 6 of 6

Disabling Command button on textbox value being true

  1. #1
    Forum Contributor
    Join Date
    11-23-2007
    Location
    Suffolk, UK
    Posts
    298

    Disabling Command button on textbox value being true

    Afternoon,

    I have a userform that has an original entry textbox15 when this text is entered into this box it has to disable Commandbutton11 and when there is a value in Textbox7 it should disable Commandbutton12, I have been trying to use the code below but to no avail.

    Any help would be greatly appreciated.

    Please Login or Register  to view this content.
    Thanks Reg
    Attached Files Attached Files

  2. #2
    Forum Expert Mordred's Avatar
    Join Date
    07-06-2010
    Location
    Winnipeg, Canada
    MS-Off Ver
    2007, 2010
    Posts
    2,787

    Re: Disabling Command button on textbox value being true

    I added
    Please Login or Register  to view this content.
    and also made a slight revision to your Initialize procedure (I added an End If).

    On a side note, you should take a little time to clean up your code so that you know what you are working with. Indenting your code while you write it is very helpful not only for yourself but for others that will be reading it.
    Attached Files Attached Files
    If you're happy with someone's help, click that little star at the bottom left of their post to give them Reps.

    ---Keep on Coding in the Free World---

  3. #3
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Disabling Command button on textbox value being true

    Does this work
    Please Login or Register  to view this content.
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  4. #4
    Forum Guru
    Join Date
    03-12-2010
    Location
    Canada
    MS-Off Ver
    2010 and 2013
    Posts
    4,418

    Re: Disabling Command button on textbox value being true

    When looking at your code, I think you need a change_event not initialize_event since your form seems to be empty when opened and not populated with any figures. So maybe something like this:

    Please Login or Register  to view this content.
    abousetta

    P.S. I second Mordred's comments who seems to have posted faster than me about cleaning up your code. It will make life a lot easier in the future when you want to make modifications. Good luck.
    Please consider:

    Thanking those who helped you. Click the star icon in the lower left part of the contributor's post and add Reputation.
    Cleaning up when you're done. Mark your thread [SOLVED] if you received your answer.

  5. #5
    Forum Contributor
    Join Date
    11-23-2007
    Location
    Suffolk, UK
    Posts
    298

    Re: Disabling Command button on textbox value being true

    Thanks everyone,

    I'll try all your solutions and let you know which one works.

    thanks reg

  6. #6
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Disabling Command button on textbox value being true

    I didn't have time to check the workbook yesterday.

    The Initialize event is missing an End IF.

    Are you actually typing True into the TextBoxes? If you are then I would have a ComboBox not a textBox. This would limit user mistakes. See UserForm 1 that I have added

    You would be better using the TextBox_Exit event in your UserForm, unless you change to ComboBoxes as above
    Attached Files Attached Files

+ 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