Click on userform transfers to listbox below

deutz

New member
Joined
May 28, 2012
Messages
27
Reaction score
0
Points
0
Hi and thanks in advance,

I am using Excel 2003

I have a userform with a listbox. When the user clicks a button on that form it opens another form with colour choices via a whole bunch of image controls. A problem occurs when I click on one of the image controls that sits directly over the listbox on the userform below. What happens is, I click the colour I want and the Colour form closes as expected but the mouse click then selects a row in the userform listbox below.

Thanks

Deutz
 
Dont' have an example to test, but I'd probably either:
-Code to select what I want to selecton on UserForm1 during UserForm'2s UserForm_Terminate event
-Code to select what I want in UserForm1's UserForm_Activate event (which should fire when it is reactivated.
 
Example spreadsheet attached

Hi Ken,

Thanks for your suggestions but Activate/Terminate events did not work. I have attached a scaled down version of the code and forms that are causing the problem with the listbox selections.

Thanks
 

Attachments

  • List Click.xls
    50 KB · Views: 56
This is a workaround you can use until it can be determined what the issue is. This code will position the Userform2 so it is not on top of the listbox after it opens. As long as userform2 does not touch the listbox everything works fine.

The code runs on the form initialize event.
You may have to adjust the width setting on you r machine . it is currently set at +220
Code:
Private Sub UserForm_Initialize()
Me.StartUpPosition = 0
Me.Top = (Application.Height - Me.Height) / 2
Me.Left = (Application.Width - Me.Width + 220)
End Sub
 
Thanks for your suggestions.

Someone else suggested I hide the second form rather than unload it and use buttons on the main form rather than images and this fixed the problem.
 
Just change your event sub to mouseUp instead of mouseDown.
 
Back
Top