LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
KR KR is offline
external usenet poster
 
Posts: 121
Default Looping procedure calls userform; how to exit loop (via userform button)?

Hi all-
using Win2K, XL2003

I have a userform that pulls inconsistent records and allows the user match
certain items to remove the inconsistent data. I've written it so it loops
through each item in the workbook and presents them all to the user.

Now that I'm testing it to see how it works, I realize that I need an "exit"
button on the form that will allow the user to escape from the loop/userform
and do other work if needed. When I click on any of my buttons that close or
hide the userform, it returns control to the loop, and just opens the
userform back up with the next inconsistent record.

Now I've added an "exit" button, but I need to do more than just hide or
close the userform, I need to break the loop. The loop I need to break is a
for..next loop, but it is not the "closest" for..next loop- what is the best
way to exit that loop?

Module 1 'contains the code to pull records, ID inconsistent data, loop
through that data, and call the userform

Private Sub 1
declarations
For... ' <---This is the loop that I need to exit
If...
If...
For... 'another For..next loop
If...
Userform1.show
end if
exit for
end if
end if
Exit for
'more stuff
Exit Sub

Many thanks,
Keith
--
The enclosed questions or comments are entirely mine and don't represent the
thoughts, views, or policy of my employer. Any errors or omissions are my
own.


 
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
how do i make a button from a userform exit onto the document in . Pieface New Users to Excel 1 April 17th 07 07:35 PM
Disable Exit button on a UserForm Noemi Excel Discussion (Misc queries) 1 September 14th 06 09:37 PM
Userform Exit button Luis Excel Programming 2 December 30th 04 03:50 PM
How to disable the Exit Button of UserForm in Excel? Alex Excel Programming 3 December 19th 04 11:55 PM
Opening a UserForm causes a crash in the Exit procedure (Which is never called) Brent McIntyre Excel Programming 0 May 12th 04 12:37 PM


All times are GMT +1. The time now is 07:17 PM.

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"