Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 573
Default How to end when test condition met?

I have a test in my program,

If strOrig < "DYC" Or "" Then

After the code below runs, I want the macro to end when strOrig = DYC
or is blank. How do I tell it to end?

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 71
Default How to end when test condition met?

Try adding the exit sub command after the if statement in the macro code.

"davegb" wrote:

I have a test in my program,

If strOrig < "DYC" Or "" Then

After the code below runs, I want the macro to end when strOrig = DYC
or is blank. How do I tell it to end?


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 55
Default How to end when test condition met?

Have you tried:

If strOrig < "DYC" Or "" Then Exit Sub

You need to be carefull doing this though as if you have changed any
application settings eg screenupdating, displayalerts they will not be
reset if you simply exit.

Regards
Rowan

davegb wrote:
I have a test in my program,

If strOrig < "DYC" Or "" Then

After the code below runs, I want the macro to end when strOrig = DYC
or is blank. How do I tell it to end?

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 55
Default How to end when test condition met?

Sorry, I think that should have been:

If strOrig = "DYC" Or strOrig = "" Then Exit Sub

Rowan wrote:
Have you tried:

If strOrig < "DYC" Or "" Then Exit Sub

You need to be carefull doing this though as if you have changed any
application settings eg screenupdating, displayalerts they will not be
reset if you simply exit.

Regards
Rowan

davegb wrote:

I have a test in my program,

If strOrig < "DYC" Or "" Then

After the code below runs, I want the macro to end when strOrig = DYC
or is blank. How do I tell it to end?

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
looping and stopping when a condition is met - test april Excel Discussion (Misc queries) 1 October 21st 09 11:36 PM
How do I test a condition in one cell and write to another. dorf Excel Worksheet Functions 2 May 19th 09 12:14 AM
logical test for an #N/A condition in a cell F.Rosario Excel Discussion (Misc queries) 6 December 19th 07 10:43 PM
Cell text based on 4 condition test Bob Wall Excel Worksheet Functions 3 November 16th 05 07:34 PM
Code to Test Condition and Save Record to Excel Ken Hudson Excel Programming 0 May 25th 05 05:32 PM


All times are GMT +1. The time now is 12:27 AM.

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

About Us

"It's about Microsoft Excel"