Private Sub CommandButton1_Click()
Columns(2).Cells.Interior.ColorIndex = xlNone '@@@@@@@@@ for checking
If ListBox1.ListIndex = -1 Then
MsgBox "First Select Sheet"
Exit Sub
End If
ListBox2.Clear
ReDim sn(1 To 8)
For x = 1 To 8
If Me("CheckBox" & x) Then
j = j + 1
sn(j) = x
End If
Next
qt = 0
With Sheets(ListBox1.Value)
lr = .Range("B" & Rows.Count).End(xlUp).Row
If lr > 2 Then
For x = 3 To lr
For i = 1 To j
If .Cells(x, sn(i) + 6) <> "" Then 'Change here @@@@@@@@@@@
qt = 1
.Cells(x, 2).Interior.ColorIndex = 4 + i '@@@@@@@@@ for checking
End If
Next
If qt = 1 Then
ListBox2.AddItem (.Cells(x, 2))
For ii = 1 To 12
ListBox2.List(ListBox2.ListCount - 1, ii) = .Cells(x, ii + 2)
Next
End If
qt = 0
Next
End If
End With
End Sub