In the table in a sheet, set up two drop-down menu pops up, if code respectively, the second drop-down menu can't hide, want to ask you how you can greatly to combine two pieces of code into a period of running,
Private Sub ListBox1_Change ()
If Reload Then Exit Sub 'see below description
For I=0 To ListBox1. ListCount - 1
If ListBox1. Selected (I)=True Then t=t & amp; "" & amp; CRH (10) & amp; ListBox1. List (I)
Next
ActiveCell=Mid (t, 2)
End Sub
Private Sub Worksheet_SelectionChange (ByVal Target As Range)
If ActiveCell. Column=7 And ActiveCell. Row & gt; 1 Then
T=ActiveCell. Value
Reload=True 'if it is according to the cell's value to modify the list box, the temporary shielding listbox change event,
With ListBox1
For I=0 To.. ListCount - 1 'activity content of cells according To modify the content of the selected in the list box
If InStr (t,. The List (I)) Then
Selected (I)=True
The Else
Selected (I)=False
End the If
Next
Reload=False
. Top=ActiveCell. Top + ActiveCell. Height 'the following statements according to activity cell location list box
. Left=ActiveCell. Left
. Width=ActiveCell. Width
The Visible=True
End With
The Else
ListBox1. Visible=False
End the If
End Sub
Private Sub ListBox2_Change ()
If Reload Then Exit Sub 'see below description
For I=0 To ListBox1. ListCount - 2
If ListBox1. Selected (I)=True Then t=t & amp; "" & amp; CRH (10) & amp; ListBox1. List (I)
Next
ActiveCell=Mid (t, 2)
End Sub
Private Sub Worksheet_SelectionChange2 (ByVal Target As Range)
If ActiveCell. Column=9 And ActiveCell. Row & gt; 1 Then
T=ActiveCell. Value
Reload=True 'if it is according to the cell's value to modify the list box, the temporary shielding listbox change event,
With ListBox1
For I=0 To.. ListCount - 1 'activity content of cells according To modify the content of the selected in the list box
If InStr (t,. The List (I)) Then
Selected (I)=True
The Else
Selected (I)=False
End the If
Next
Reload=False
. Top=ActiveCell. Top + ActiveCell. Height 'the following statements according to activity cell location list box
. Left=ActiveCell. Left
. Width=ActiveCell. Width
The Visible=True
End With
The Else
ListBox1. Visible=False
End the If
End Sub