+ Reply to Thread
Results 1 to 4 of 4

Thread: If Then Help with a Userform

  1. #1
    Registered User
    Join Date
    12-21-2011
    Location
    Nashville, TN
    MS-Off Ver
    Excel 2010
    Posts
    3

    If Then Help with a Userform

    I am currently writing code for a userform in Excel 2010 using visual basic. What I have in the userform is a textbox to enter a restriction such as office or warehouse. When the command button on the userform is executed then excel distributes the information in the userform to several spreadsheets. One of the spreadsheets is a name badge for the visitor. What I am having trouble with is this:

    Currently when a restriction is entered in the userform, that same word or phrase is entered into a restrictions section on the name badge. What I want to happen though is if there is a restriction entered into the userform (anything at all) then a uppercase X will appear in the name badge spreadsheet in cell (13, 1). I have tried using if then statements but cannot seem to figure it out. Any help would be well appreciated!

    I have attached the file if you would like to see my explanation in excel with the actual file.
    Attached Files Attached Files

  2. #2
    Forum Guru pike's Avatar
    Join Date
    12-11-2005
    Location
    Alstonville, Australia
    MS-Off Ver
    2010
    Posts
    5,150

    Re: Excel 2010 If Then Help with a Userform

    Hi iwiman
    welcome to the forum
    you could add a iif statment
    Cells(emptyRow, 1).Value = LastNameTextBox.Value & IIf(RestrictionsTextBox.Value <> "",  " X", "")
    regards pike

    If the solution helped please donate
    here to the RSPCA

    Sites worth visiting;

    J&R Solutions - royUK

    AJP Excel Information - Andy Pope

    Spreadsheet Toolbox

    VBA for smarties - snb

  3. #3
    Registered User
    Join Date
    12-21-2011
    Location
    Nashville, TN
    MS-Off Ver
    Excel 2010
    Posts
    3

    Re: Excel 2010 If Then Help with a Userform

    pike,

    Thanks for the help! It worked great! I wasnt really sure of the IIF code so your help in this was much appreciated.

  4. #4
    Forum Guru pike's Avatar
    Join Date
    12-11-2005
    Location
    Alstonville, Australia
    MS-Off Ver
    2010
    Posts
    5,150

    Re: If Then Help with a Userform

    If you are satisfied with the solution(s) provided, please mark your thread as Solved.

    How to mark a thread Solved
    Go to the first post
    Click edit
    Click Go Advanced
    Just below the word Title you will see a dropdown with the word No prefix.
    Change to Solved
    Click Save
    regards pike

    If the solution helped please donate
    here to the RSPCA

    Sites worth visiting;

    J&R Solutions - royUK

    AJP Excel Information - Andy Pope

    Spreadsheet Toolbox

    VBA for smarties - snb

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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.2.0