UF within a loop

  • Thread starter Thread starter Otto Moehrbach
  • Start date Start date
O

Otto Moehrbach

Excel 2002, WinXP
Up until now I have always used a UF in a structure of:
UF.Show
The UF OKClick macro calls a macro.
That macro:
Make selections
Builds an array or does something with the selection.
End macro
The UF OKClick macro unloads the UF.

Now I want to put the UF inside a loop with the following structure:
Start the loop.
UF.Show (Have an OK button but no Private OKClick macro at all)
Make selections.
Build an array or do something with the selection.
Unload the UF
Exit Sub if conditions warrant
Modify the ranges and properties of the UF components (like a ListBox)
Loop

I just don't want to write all this code if my basic structure is flawed.
Is the basic structure flawed?
Will the code move on even though there is no Private OKClick macro?
Thank you for your help. Otto
 
I can see already that the code will not go on to the next line after the
UF.Show line without a Private OKClick macro telling it to do so. What
should that macro say? Thanks for your help. Otto
 
Otto,

You should be able to put code in the UserForm_Activate event
to run a routine while the form is showing....

Private Sub UserForm_Activate
Repaint 'optional
Call DoMyOtherStuff(Val(UserForm1.Tag))
End Sub

Regards,
Jim Cone
San Francisco, USA
 
Jim
Thanks for your response. I don't think that will work in my case. The
UF has a ListBox (MultiSelect). The user selects one or more items and the
code does things with the selection(s). I think I have to revamp my
thinking some. Thanks again. Otto
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top