View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Ken Ken is offline
external usenet poster
 
Posts: 207
Default listbox click event question

I am using Excel 2003. I have a two userforms, one with a listbox and
one with a commandbutton. The click event of the listbox on userform1
hides the userform1 and shows userform2. The commandbutton on
userform2 unloads userform2 and shows userform 1.

It works exactly as I want it for the first click of the listbox;
however, after the commandbutton on userform2 is clicedk to close
userform2 and show userform1, the click event on the listbox does not
fire.

This is initiating code

Sub test()
UserForm1.Show
End Sub

This is the code for the listbox

Private Sub ListBox1_Click()
Me.Hide
UserForm2.Show
End Sub

This is the code for the commandbutton

Private Sub CommandButton1_Click()
Unload Me
UserForm1.Show
End Sub

When I change it so userform1 is unloaded, not just hidden, it works
repetitively. I prefer not to unload userform1 because there is a
significant amount of data loaded and takes a few second each time.

Can anyone explain why this event is not triggered after the first
iteration of hiding and then redisplaying?

Thanks

Ken