1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51
| Dim i As Long
Dim lItem As Long
With Sheet5
Columns("B:I").Hidden = Not CheckBox1.Value
Columns("L:O").Hidden = Not CheckBox2.Value
Columns("J:K").Hidden = Not CheckBox3.Value
Columns("P").Hidden = Not CheckBox3.Value
Columns("S").Hidden = Not CheckBox3.Value
Columns("Q:R").Hidden = Not CheckBox5.Value
Columns("Z:AA").Hidden = Not CheckBox4.Value
Columns("T:U").Hidden = Not CheckBox4.Value
Columns("V:Y").Hidden = Not CheckBox6.Value
For i = 2 To 500
For lItem = 0 To UserForm2.LB_market.ListCount - 1
If UserForm2.LB_market.Selected(lItem) = True And .Range("B" & i).Value <> UserForm2.LB_market.List(lItem) Then
Rows(i).Hidden = True
UserForm2.LB_market.Selected(lItem) = False
End If
Next
If (Sheet5.Cells(i, "v") <> ComboBox2.Value And ComboBox2.Value <> "") Or (Sheet5.Cells(i, "n") <> ComboBox3.Value And ComboBox3.Value <> "") Or (Sheet5.Cells(i, "l") <> ComboBox4.Value And ComboBox4.Value <> "") Then
Sheet5.Rows(i).Hidden = True
End If
Next
'CheckBox1 = Unchecked
'CheckBox2 = Unchecked
'CheckBox3 = Unchecked
'CheckBox4 = Unchecked
'CheckBox5 = Unchecked
'CheckBox5 = Unchecked
'CheckBox6 = Unchecked
'ComboBox2.Value = Empty
'ComboBox3.Value = Empty
'ComboBox4.Value = Empty
UserForm2.Hide
End With |