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
 

Ken Puls

Administrator
Staff member
Joined
Mar 13, 2011
Messages
2,522
Reaction score
6
Points
38
Location
Nanaimo, BC, Canada
Website
www.excelguru.ca
Excel Version(s)
Excel Office 365 Insider
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.
 

deutz

New member
Joined
May 28, 2012
Messages
27
Reaction score
0
Points
0
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

tommyt61

New member
Joined
Mar 26, 2011
Messages
153
Reaction score
0
Points
0
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
 

deutz

New member
Joined
May 28, 2012
Messages
27
Reaction score
0
Points
0
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.
 

nevadaDave

New member
Joined
Jul 24, 2012
Messages
9
Reaction score
0
Points
0
Just change your event sub to mouseUp instead of mouseDown.
 
Top