View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
salgud salgud is offline
external usenet poster
 
Posts: 219
Default Userform - what am I missing?

On Sat, 14 Mar 2009 14:49:36 -0500, Chip Pearson wrote:
Thanks, Chip! Reply inline
That's exactly what I thought and what I want, but it's not running
after I click "Next" or "Finish".


I assume that "Next" and "Finish" refer to buttons on the userform.
Those buttons should (after anything else) Hide the form with Me.Hide
or unload the form with Unload Me. If you use Unload, the form is
dumped from memory and you cannot access the form's values. If you use
Hide, you can still get form values after the form is closed. Do not
use "End" (not to be confused with "End Sub" or other "End" code --
this means just "End" by itself). Using "End" terminates everything
and dumps everything from memory and completely stops execution. For
example, use

Private Sub btnFinish_Click()
Me.Hide
End Sub

That's what I had wrong, I had the "userform.hide" in the module code
thinking it would execute when I finished with the uerform. I put "Me.Hide"
at the very end of each userform routine and it works fine.