Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
if condition skip to next line of code
hello all,
I am using the following if statement to evaluate conditions on my user form. My problem is how to handle if a text box has the value 0, i want the system to do nothing, and move to the next condition evaluation. Using Exit Sub busts right out of the block of code, and that isn't what works. How can i do this? If Me.txtNearMiss.Value = "0" Then exit sub ElseIf Not (Me.txtNearMiss.Value = "") And Me.txtDescNearMiss.Value = "" Then MsgBox "A value has been identified in the Near Miss Incidents field. A description of each incident is required." End if -- Carlee |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
if condition skip to next line of code
don't know what your code looks like other than waht you posted, but you can try
this. the code will continue after the end if if Me.txtNearMiss.Value = 0 If Me.txtNearMiss.Value = "0" Then ' do nothing ElseIf Not (Me.txtNearMiss.Value = "") And Me.txtDescNearMiss.Value = "" Then MsgBox _ "A value has been identified in the Near Miss Incidents field. A description of each incident is required." End If -- Gary "Carlee" wrote in message ... hello all, I am using the following if statement to evaluate conditions on my user form. My problem is how to handle if a text box has the value 0, i want the system to do nothing, and move to the next condition evaluation. Using Exit Sub busts right out of the block of code, and that isn't what works. How can i do this? If Me.txtNearMiss.Value = "0" Then exit sub ElseIf Not (Me.txtNearMiss.Value = "") And Me.txtDescNearMiss.Value = "" Then MsgBox "A value has been identified in the Near Miss Incidents field. A description of each incident is required." End if -- Carlee |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
if condition skip to next line of code
To do nothing? Have no code. Simply remove the line:
Exit Sub -- p45cal "Carlee" wrote: hello all, I am using the following if statement to evaluate conditions on my user form. My problem is how to handle if a text box has the value 0, i want the system to do nothing, and move to the next condition evaluation. Using Exit Sub busts right out of the block of code, and that isn't what works. How can i do this? If Me.txtNearMiss.Value = "0" Then exit sub ElseIf Not (Me.txtNearMiss.Value = "") And Me.txtDescNearMiss.Value = "" Then MsgBox "A value has been identified in the Near Miss Incidents field. A description of each incident is required." End if -- Carlee |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Skip a statment or line in vba | Excel Discussion (Misc queries) | |||
Skip code | Excel Programming | |||
How, on a line chart, to skip blank entry rather than plot as 0? | Charts and Charting in Excel | |||
skip some code | Excel Programming | |||
skip code | Excel Programming |