+ Reply to Thread
Results 1 to 4 of 4

Using If function with VBA UserForm

  1. #1
    Forum Contributor
    Join Date
    10-25-2012
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    292

    Using If function with VBA UserForm

    I have created my first ever UserForm using VBA. Only took about three weeks and the welcomed help of this forum. I have another question. Part of the form we use accounts for two types of candidates. If they are internal candidates, then there are less steps we need to take than if they are an external candidate. So, on the form there is a column for 'external' and a column for 'internal'. On the excel worksheet there are black squares blocking steps to be taken for internal candidates, because they do not apply to them.

    Please see the example of the sheet here: Attachment 192422

    Using VBA in this UserForm, how could I apply a check box for the user to signify if the candidate is external or external, then if the candidate is internal the program puts fills in the appropriate squares with a black fill so when it's printed out and the person using the printed form knows those steps don't need to be taken?

    I would like to modify the UserForm and the excel worksheet so it only has one column to cover both Internal AND External Candidates and use an If function VBA to modify that column according to the input by the user as well as block the user from inputting data within the userform, see below.

    For example, looking at the above attached example, under Internal/External columns on the excel worksheet, Status on 'other Jo's In PS, Status' on other 'JO's in Taleo', and 'Status in EDPM/Schedule Drug Screen' are not options necessary for Internal candidates.

    1) User Check Marks this candidate is internal and the cells for those three are blacked out on worksheet.
    2) When User Check Marks this candidate is internal and those same three input fields in the UserForm are no longer optional for the user to input data.

    Please, when giving the answers to these, remember that I am very knew to this. I may need more information than simply given the necessary code. I'll need to know where to put that code and anything else I may need to do to make it work. After I am done making this form, I have to create a written tutorial on how this was created so someone behind me can modify it after I move on.

    I appreciate your help with this!
    Last edited by eemiller1997; 11-09-2012 at 10:56 AM.

  2. #2
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: Using If function with VBA UserForm

    I would recommend you use two Option Buttons instead of a checkbox on the userform. I think it would be more intuitive to the user.

    First create your Userform with just the one set of candidate fields (all of them for both external and internal). Include the two option buttons at the top. (e.g. named ; optInteral and optExternal)

    Create the worksheet so it has just the one column for Internal\External.

    Post that workbook and I will show you the code . It should be fairly simple. When you select one of the option buttons, it will hide\show the three textboxes on the userform and worksheet.

  3. #3
    Forum Contributor
    Join Date
    10-25-2012
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    292

    Re: Using If function with VBA UserForm

    Thank you for your help!

    Does the attached form here demonstrate what you were saying?

    !Interview Multi-Page UserForm Test.xls

  4. #4
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: Using If function with VBA UserForm

    Here is what AlphaFrog is describing [eemiller1997=!Interview UserForm multi.xlsm], and I agree completely with this approach.

    Edited to add: Also the content of the two comboboxes for eligibility are different for internal/external, so have to be switched when the user changes option buttons. You'll see that the code sets the RowSource property of these if an option button is selected.
    Last edited by 6StringJazzer; 11-12-2012 at 09:21 PM. Reason: as shown
    Jeff
    | | |會 |會 |會 |會 | |:| | |會 |會
    Read the rules
    Use code tags to [code]enclose your code![/code]

+ 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