This is my first time working with an InputBox. The desire is to have the user insert their initials for entry into a spreadsheet that will be imported into a database. I'm using the InputBox to promote consistency and AutoFill the necessary cells.
I am having trouble understanding a process whereby a user enters information, if the entry is two letters its accepted and populated into the cells, else a message appears indicating two letters are required and the InputBox displays again. Through testing I believe my loop is not working as I would expect. If the first entry is two letters it populates information into excel as expected. If, however, the first entry is incorrect and a subsequent entry is correct it does not seem to exit the loop. I'm not sure why this would be? Any help would be greatly appreciated.
Dim c As Range
Set c = Sheets("CompilePriceAdjustments").Range("E2")
c = InputBox("Please Enter Initials", "PRICE INCREASE APPROVER")
Do Until c = vbString And Len(c) = 2
MsgBox ("You must enter two letters")
c = InputBox("Please Enter Initials", "PRICE INCREASE APPROVER")
Loop
Sheets("CompilePriceAdjustments").Range("E2").Value = UCase(c)
c.AutoFill Destination:=Sheets("CompilePriceAdjustments").Range("E2:E" & Cells (Rows.Count, "D").End(xlUp).Row)
I think this is what you are trying?
EDIT
I see one flaw in your approach. What if the user wants to cancel and exit? You might want to consider this code?
Consider: