PDA

View Full Version : KeyCode = 9 Combobox Disappears



Emoncada
11-12-2012, 04:07 PM
I am having issues with the ActiveX Controls on a spreadsheet. I have 3 Comboboxes and 2 textboxes. I use KeyCode 9 to tab threw the controls, but noticed that when I tab over instead of making that control activate, it's disappearing.

Private Sub txtBox1_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)
If KeyCode = 9 Then
CmbResolution.Activate
End If
End Sub

I don't understand why, but if i click somewhere on the spreadsheet it re-appears. Not sure if this a known issue with keycode and comboboxes.
I am using excel 2007.

Any ideas how to fix this?

Jan Karel Pieterse
11-12-2012, 11:39 PM
Perhaps there are two controls on top of each other?

Emoncada
11-13-2012, 07:15 AM
I discovered what's causing the issue, not sure if someone seen this before or this is a bug.

I have the controls in row 1 and I froze the top row which contain these controls. So when the row is frozen and I tab from 1 control to another it disappears. But everything works perfectly when Everything is unfrozen.

Any Solutions?

Jan Karel Pieterse
11-13-2012, 11:31 PM
Do any of the controls "touch" the bottom cell border and thus cross the frozen boundary?

Emoncada
11-14-2012, 07:10 PM
No, no controls touch any other cell then there cell in row 1

Jan Karel Pieterse
11-14-2012, 10:22 PM
I'm afraid I have no asnwer. Excel has never really liked the ActiveX controls much and unfortunately, this has not become better over the versions.

snb
11-15-2012, 01:20 AM
Refreshing the sheet (e.g. switching between sheets) will return everything to 'normal'

Davide
05-07-2015, 01:20 AM
Refreshing the sheet (e.g. switching between sheets) will return everything to 'normal'

If you don't want to reactivate the sheet because you have a macro on sheet activation you can place another line after combobox.activate (which activate the combobox but somehow also hideit from the view) you can put a line on size or position that will make the combo box visible like: combobox.top = combobox.top