Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 155
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,494
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 107
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Skip a statment or line in vba Cue Excel Discussion (Misc queries) 5 June 29th 08 12:47 AM
Skip code Patrick Simonds Excel Programming 1 December 30th 06 03:31 PM
How, on a line chart, to skip blank entry rather than plot as 0? JohnTerp Charts and Charting in Excel 1 July 12th 06 11:11 PM
skip some code davegb Excel Programming 5 December 1st 05 05:22 PM
skip code monika Excel Programming 1 February 26th 04 02:33 AM


All times are GMT +1. The time now is 07:42 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"