I am making a macro that when a workbook opens, an inputbox runs that asks for a password. Valid passwords are certain names, and what name you enter determines what type of access you have in the document (i.e., 'bob' allows data to be entered, 'mary' hides certain rows and columns, etc.). I do this by having on another worksheet in the workbook the valid names in one column and next to them code words that determine the permissions allowed for that name. When a name is entered the code searches for the name, and if it is valid it sets the corresponding code word located next to it as a variable. I want an error message to appear if a name that is not on the approved list is entered, the default entry in the inputbox is left in the user input line, or if the user input line is blank, and cycle back to the original inputbox. Also, I only want the user to have three chances at entering a valid name before the workbook closes automatically. In addition, if the user hits 'cancel' on the inputbox, I want the workbook to close.
Here is my code thus far:
Please Login or Register to view this content.
I either get an error message saying I have an 'End If' without an 'If', or a 'Next' without a 'For', or an 'Else' without an 'If'.
Bookmarks