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.
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
pike,
Thanks for the help! It worked great! I wasnt really sure of the IIF code so your help in this was much appreciated.
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
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks