Sub loadcmb()
Dim sdsheet As Worksheet
Set sdsheet = ThisWorkbook.Sheets("Sortsheet")
If sdsheet.Cells(Rows.Count, 1).End(xlUp).Row = 1 Then
lr = 2
Else
lr = sdsheet.Cells(Rows.Count, 1).End(xlUp).Row
End If
SortForm.ComboBox1.Clear
If SortForm.CheckBox1 = True Then
For x = 2 To lr
If SortForm.OptionButton1 = True Then
SortForm.ComboBox1.AddItem Sortsheet.Cells(x, 1) & " - " & Sortsheet.Cells(x, 2)
Else
SortForm.ComboBox1.AddItem Sortsheet.Cells(x, 2) & " - " & Sortsheet.Cells(x, 1)
End If
Next x
Else
For x = 2 To lr
If SortForm.OptionButton1 = True Then
If UCase(Cells(x, 14)) = "A" Then
SortForm.ComboBox1.AddItem Sortsheet.Cells(x, 1) & " - " & Sortsheet.Cells(x, 2)
End If
Else
If UCase(Cells(x, 14)) = "A" Then
SortForm.ComboBox1.AddItem Sortsheet.Cells(x, 2) & " - " & Sortsheet.Cells(x, 1)
End If
End If
Next x
End If
End Sub
Dim sdsheet As Worksheet
Set sdsheet = ThisWorkbook.Sheets("Sortsheet")
If sdsheet.Cells(Rows.Count, 1).End(xlUp).Row = 1 Then
lr = 2
Else
lr = sdsheet.Cells(Rows.Count, 1).End(xlUp).Row
End If
SortForm.ComboBox1.Clear
If SortForm.CheckBox1 = True Then
For x = 2 To lr
If SortForm.OptionButton1 = True Then
SortForm.ComboBox1.AddItem Sortsheet.Cells(x, 1) & " - " & Sortsheet.Cells(x, 2)
Else
SortForm.ComboBox1.AddItem Sortsheet.Cells(x, 2) & " - " & Sortsheet.Cells(x, 1)
End If
Next x
Else
For x = 2 To lr
If SortForm.OptionButton1 = True Then
If UCase(Cells(x, 14)) = "A" Then
SortForm.ComboBox1.AddItem Sortsheet.Cells(x, 1) & " - " & Sortsheet.Cells(x, 2)
End If
Else
If UCase(Cells(x, 14)) = "A" Then
SortForm.ComboBox1.AddItem Sortsheet.Cells(x, 2) & " - " & Sortsheet.Cells(x, 1)
End If
End If
Next x
End If
End Sub
No comments:
Post a Comment