Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
if - loop?
Hi, If the user input the wrong info, a msg will pop up. How can i prevent the macro from running through the rest, but instead loop back until the user inputs the correct info? Thanks, Stefan .... .... If [ccard2].Formula Like "#" Then ' 1 MsgBox "Please enter 5 digits." & Chr(10) _ & "I.e. '04' for month, '/' for the divider and '05' for the year." & Chr(10) _ & "This would look like 04/05." _ & Chr(10) & Chr(10) & "Thank you.", vbInformation, "Incorrect Entry Notice" Range("ccard2").Select End If MsgBox "Thank you." .... .... -- Message posted via http://www.officekb.com |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
if - loop?
Stefan,
Dim Flag Flag = 0 Do Until Flag = 1 Flag = 1 If [ccard2].Formula Like "#" Then ' 1 MsgBox "Please enter 5 digits." & Chr(10) _ & "I.e. '04' for month, '/' for the divider and '05' for the year." & Chr(10) _ & "This would look like 04/05." _ & Chr(10) & Chr(10) & "Thank you.", vbInformation, "Incorrect Entry Notice" Range("ccard2").Select Flag = 0 End If Loop MsgBox "Thank you." "stefan via OfficeKB.com" wrote in message ... Hi, If the user input the wrong info, a msg will pop up. How can i prevent the macro from running through the rest, but instead loop back until the user inputs the correct info? Thanks, Stefan ... ... If [ccard2].Formula Like "#" Then ' 1 MsgBox "Please enter 5 digits." & Chr(10) _ & "I.e. '04' for month, '/' for the divider and '05' for the year." & Chr(10) _ & "This would look like 04/05." _ & Chr(10) & Chr(10) & "Thank you.", vbInformation, "Incorrect Entry Notice" Range("ccard2").Select End If MsgBox "Thank you." ... ... -- Message posted via http://www.officekb.com |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Find loop doesn't loop | Excel Discussion (Misc queries) | |||
Problem adding charts using Do-Loop Until loop | Excel Programming | |||
How do I create a For loop within a For loop? | Excel Programming | |||
For/Loop skipping one value in loop only | Excel Programming | |||
HELP!!!! Can't stop a loop (NOT an infinite loop) | Excel Programming |