+ Reply to Thread
Results 1 to 7 of 7

Write If/And statement for userform textboxes that are only visible

  1. #1
    Forum Contributor
    Join Date
    12-20-2011
    Location
    United States, Ohio
    MS-Off Ver
    Excel 2010
    Posts
    295

    Write If/And statement for userform textboxes that are only visible

    I am trying to write an "if + and" statement that is like the following. (This is all for a userform)

    Upon the user hitting the submit buttton:

    Please Login or Register  to view this content.
    it ths only visible textboxes that are blank I am having trouble with and dont know how to code.

    Those textboxes that are named (and visible -which is dyanimic):
    Please Login or Register  to view this content.
    and tbxBuildingcount is just a value from a spin button.


    I am just trying to error trap and make sure that the user has filled out every visible textbox and if they dont, then warn them that they do.
    The reason for the checkbox is that is it is true, then they can proceed. But if false, and some blank textboxes, they get this warning.

    Thanks in advance.
    Last edited by clemsoncooz; 02-15-2012 at 11:11 AM.

  2. #2
    Forum Expert tigeravatar's Avatar
    Join Date
    03-25-2011
    Location
    Colorado, USA
    MS-Off Ver
    Excel 2003 - 2013
    Posts
    5,361

    Re: Write If/And statement for userform textboxes that are only visible

    clemsoncooz,

    Give this a try:
    Please Login or Register  to view this content.
    Hope that helps,
    ~tigeravatar

    Forum Rules: How to use code tags, mark a thread solved, and keep yourself out of trouble

  3. #3
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Write If/And statement for userform textboxes that are only visible

    Hi,

    You mention textboxes plural but your code only shows one TextBox(y). In which case why not just

    Please Login or Register  to view this content.
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  4. #4
    Forum Contributor
    Join Date
    12-20-2011
    Location
    United States, Ohio
    MS-Off Ver
    Excel 2010
    Posts
    295

    Re: Write If/And statement for userform textboxes that are only visible

    Quote Originally Posted by Richard Buttrey View Post
    You mention textboxes plural but your code only shows one TextBox(y). In which case why not just[...]
    "Y" is a loop starting at 1 and ending at whichever the user choose tbxBuidlingcount to be by using a spin buttong. tbxbuilidngcount will be a number 1 to 10.


    EDIT UPDATE: I posted this before thinking about your recommendation. Sorry. I thought you were saying that I only have one text box (opposite of plural). So I posted. But now after I re-read your post - I think this could work. Let me see.
    Last edited by clemsoncooz; 02-15-2012 at 10:36 AM.

  5. #5
    Forum Contributor
    Join Date
    12-20-2011
    Location
    United States, Ohio
    MS-Off Ver
    Excel 2010
    Posts
    295

    Re: Write If/And statement for userform textboxes that are only visible

    I havent tried tigeravater's recommendation yet. Thats what I am working on now. Stay tunned.

  6. #6
    Forum Contributor
    Join Date
    12-20-2011
    Location
    United States, Ohio
    MS-Off Ver
    Excel 2010
    Posts
    295

    Re: Write If/And statement for userform textboxes that are only visible

    Quote Originally Posted by Richard Buttrey View Post
    Hi,

    You mention textboxes plural but your code only shows one TextBox(y). In which case why not just

    Please Login or Register  to view this content.

    Okay - For me to do this I think - it requires a second question: How do I use variables from a another private procedure that is within the same module?

    Because where I am writing this If statement is located within the SUBIT click event. And I define Y in another private procedure go a "GO button" Click event.

  7. #7
    Forum Contributor
    Join Date
    12-20-2011
    Location
    United States, Ohio
    MS-Off Ver
    Excel 2010
    Posts
    295

    Re: Write If/And statement for userform textboxes that are only visible

    Quote Originally Posted by tigeravatar View Post
    clemsoncooz,

    Give this a try:
    This took care of it tigeravatar (I justed needed to change one "OR" to an "AND")!!!

    Thank you so much!

+ 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