Quick question:
How do you hide (via code) the dropdown list that appears when you use the .Dropdown method of a combobox (i.e. MyComboBox.Dropdown )?
Longwinded explanation why:
For a custom data validation routine, I use the Worksheet_BeforeDoubleClick event to populate a combobox named ValidationBox with my desired values, position it over the double-clicked cell and size it to match, make it visible. Today I thought of using ValidationBox.Dropdown to display the list.
Once the user selects a value, I use the ValidationBox_Click event to write the value to the underlying cell, and hide ValidationBox. The following routine was doing just that until I added the .Dropdown method in the first step. Now Validationbox doesn't get hidden (although the value still gets written to the underlying cell, and the adjacent cell still gets selected):
Private Sub ValidationBox_Click()
ValidationBox.Visible = False
ActiveCell.Value = ValidationBox.Text
ActiveCell.Offset(0, 1).Activate
End Sub
What's the deal? Do I need to somehow "un-Dropdown" the list before I can hide it?
Thanks!
VBAjedi![[swords] [swords] [swords]](/data/assets/smilies/swords.gif)
How do you hide (via code) the dropdown list that appears when you use the .Dropdown method of a combobox (i.e. MyComboBox.Dropdown )?
Longwinded explanation why:
For a custom data validation routine, I use the Worksheet_BeforeDoubleClick event to populate a combobox named ValidationBox with my desired values, position it over the double-clicked cell and size it to match, make it visible. Today I thought of using ValidationBox.Dropdown to display the list.
Once the user selects a value, I use the ValidationBox_Click event to write the value to the underlying cell, and hide ValidationBox. The following routine was doing just that until I added the .Dropdown method in the first step. Now Validationbox doesn't get hidden (although the value still gets written to the underlying cell, and the adjacent cell still gets selected):
Private Sub ValidationBox_Click()
ValidationBox.Visible = False
ActiveCell.Value = ValidationBox.Text
ActiveCell.Offset(0, 1).Activate
End Sub
What's the deal? Do I need to somehow "un-Dropdown" the list before I can hide it?
Thanks!
VBAjedi
![[swords] [swords] [swords]](/data/assets/smilies/swords.gif)