I have a little problem. I want the dropdown list of the ComboBox to close when I select another cell or switch to another sheet. For example, if I open the ComboBox in cell G8 and the dropdown list is shown, but I don’t select anything from that list and then select cell A8, the cell A8 is selected but the dropdown list remains open and frozen. The same happens if I switch sheets; if the dropdown list is visible and I switch sheets, the dropdown list remains frozen in the middle of the screen, interfering with the new sheet.
How should I handle this?
my code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim rng As Range
Set rng = Me.Range(“G8:G407”)
If Not Intersect(Target, rng) Is Nothing Then
With Me.ComboBox1
.Visible = True
.Left = Target.Left
.Top = Target.Top
.Width = Target.Width
.Height = Target.Height
.LinkedCell = Target.Address
.ListFillRange = "JURISDICCIONES!A2:A26"
.DropDown
End With
End If
End Sub
I tried setting up the ComboBox so that its dropdown list would automatically close when selecting a different cell or switching to another sheet. I expected that when changing cells or sheets, the dropdown list would close as intended. However, the dropdown list remains open and visible, causing it to overlap and interfere with the new selection or sheet.