I've done this code the long way and would like for it to be shortened.
Essentially, just need to use loops to get what I'm trying to achieve, but can't work it out :nono:
Code
Private Sub CommandButton1_Click()
Dim found As Range
Set found = Sheets("Sheet1").Columns("A").Find(what:=ComboBox1.Value, LookIn:=xlValues, lookat:=xlWhole)
Dim found1 As Range
Set found1 = Sheets("Sheet1").Columns("A").Find(what:=ComboBox2.Value, LookIn:=xlValues, lookat:=xlWhole)
Dim found2 As Range
Set found2 = Sheets("Sheet1").Columns("A").Find(what:=ComboBox3.Value, LookIn:=xlValues, lookat:=xlWhole)
Dim found3 As Range
Set found3 = Sheets("Sheet1").Columns("A").Find(what:=ComboBox4.Value, LookIn:=xlValues, lookat:=xlWhole)
Dim found4 As Range
Set found4 = Sheets("Sheet1").Columns("A").Find(what:=ComboBox5.Value, LookIn:=xlValues, lookat:=xlWhole)
Dim found5 As Range
Set found5 = Sheets("Sheet1").Columns("A").Find(what:=ComboBox6.Value, LookIn:=xlValues, lookat:=xlWhole)
Dim found6 As Range
Set found6 = Sheets("Sheet1").Columns("A").Find(what:=ComboBox7.Value, LookIn:=xlValues, lookat:=xlWhole)
Dim found7 As Range
Set found7 = Sheets("Sheet1").Columns("A").Find(what:=ComboBox8.Value, LookIn:=xlValues, lookat:=xlWhole)
Dim found8 As Range
Set found8 = Sheets("Sheet1").Columns("A").Find(what:=ComboBox9.Value, LookIn:=xlValues, lookat:=xlWhole)
Dim found9 As Range
Set found9 = Sheets("Sheet1").Columns("A").Find(what:=ComboBox10.Value, LookIn:=xlValues, lookat:=xlWhole)
Dim found10 As Range
Set found10 = Sheets("Sheet1").Columns("A").Find(what:=ComboBox11.Value, LookIn:=xlValues, lookat:=xlWhole)
Dim found11 As Range
Set found11 = Sheets("Sheet1").Columns("A").Find(what:=ComboBox12.Value, LookIn:=xlValues, lookat:=xlWhole)
Dim found12 As Range
Set found12 = Sheets("Sheet1").Columns("A").Find(what:=ComboBox13.Value, LookIn:=xlValues, lookat:=xlWhole)
Dim found13 As Range
Set found13 = Sheets("Sheet1").Columns("A").Find(what:=ComboBox14.Value, LookIn:=xlValues, lookat:=xlWhole)
Dim found14 As Range
Set found14 = Sheets("Sheet1").Columns("A").Find(what:=ComboBox15.Value, LookIn:=xlValues, lookat:=xlWhole)
Dim found15 As Range
Set found15 = Sheets("Sheet1").Columns("A").Find(what:=ComboBox16.Value, LookIn:=xlValues, lookat:=xlWhole)
Dim found16 As Range
Set found16 = Sheets("Sheet1").Columns("A").Find(what:=ComboBox17.Value, LookIn:=xlValues, lookat:=xlWhole)
Dim found17 As Range
Set found17 = Sheets("Sheet1").Columns("A").Find(what:=ComboBox18.Value, LookIn:=xlValues, lookat:=xlWhole)
Dim found18 As Range
Set found18 = Sheets("Sheet1").Columns("A").Find(what:=ComboBox19.Value, LookIn:=xlValues, lookat:=xlWhole)
Dim found19 As Range
Set found19 = Sheets("Sheet1").Columns("A").Find(what:=ComboBox20.Value, LookIn:=xlValues, lookat:=xlWhole)
Dim found20 As Range
Set found20 = Sheets("Sheet1").Columns("A").Find(what:=ComboBox21.Value, LookIn:=xlValues, lookat:=xlWhole)
Dim found21 As Range
Set found21 = Sheets("Sheet1").Columns("A").Find(what:=ComboBox22.Value, LookIn:=xlValues, lookat:=xlWhole)
Dim found22 As Range
Set found22 = Sheets("Sheet1").Columns("A").Find(what:=ComboBox23.Value, LookIn:=xlValues, lookat:=xlWhole)
Dim found23 As Range
Set found23 = Sheets("Sheet1").Columns("A").Find(what:=ComboBox24.Value, LookIn:=xlValues, lookat:=xlWhole)
Dim found24 As Range
Set found24 = Sheets("Sheet1").Columns("A").Find(what:=ComboBox25.Value, LookIn:=xlValues, lookat:=xlWhole)
Dim found25 As Range
Set found25 = Sheets("Sheet1").Columns("A").Find(what:=ComboBox26.Value, LookIn:=xlValues, lookat:=xlWhole)
Dim found26 As Range
Set found26 = Sheets("Sheet1").Columns("A").Find(what:=ComboBox27.Value, LookIn:=xlValues, lookat:=xlWhole)
found.Select
ActiveCell.Offset(rowOffset:=0, columnOffset:=1).Activate
ActiveCell = ActiveCell.Value + 1
found1.Select
ActiveCell.Offset(rowOffset:=0, columnOffset:=1).Activate
ActiveCell = ActiveCell.Value + 1
found2.Select
ActiveCell.Offset(rowOffset:=0, columnOffset:=1).Activate
ActiveCell = ActiveCell.Value + 1
found3.Select
ActiveCell.Offset(rowOffset:=0, columnOffset:=1).Activate
ActiveCell = ActiveCell.Value + 1
found4.Select
ActiveCell.Offset(rowOffset:=0, columnOffset:=1).Activate
ActiveCell = ActiveCell.Value + 1
found5.Select
ActiveCell.Offset(rowOffset:=0, columnOffset:=1).Activate
ActiveCell = ActiveCell.Value + 1
found6.Select
ActiveCell.Offset(rowOffset:=0, columnOffset:=1).Activate
ActiveCell = ActiveCell.Value + 1
found7.Select
ActiveCell.Offset(rowOffset:=0, columnOffset:=1).Activate
ActiveCell = ActiveCell.Value + 1
found8.Select
ActiveCell.Offset(rowOffset:=0, columnOffset:=1).Activate
ActiveCell = ActiveCell.Value + 1
found9.Select
ActiveCell.Offset(rowOffset:=0, columnOffset:=1).Activate
ActiveCell = ActiveCell.Value + 1
found10.Select
ActiveCell.Offset(rowOffset:=0, columnOffset:=1).Activate
ActiveCell = ActiveCell.Value + 1
found11.Select
ActiveCell.Offset(rowOffset:=0, columnOffset:=1).Activate
ActiveCell = ActiveCell.Value + 1
found12.Select
ActiveCell.Offset(rowOffset:=0, columnOffset:=1).Activate
ActiveCell = ActiveCell.Value + 1
found13.Select
ActiveCell.Offset(rowOffset:=0, columnOffset:=1).Activate
ActiveCell = ActiveCell.Value + 1
found14.Select
ActiveCell.Offset(rowOffset:=0, columnOffset:=1).Activate
ActiveCell = ActiveCell.Value + 1
found15.Select
ActiveCell.Offset(rowOffset:=0, columnOffset:=1).Activate
ActiveCell = ActiveCell.Value + 1
found16.Select
ActiveCell.Offset(rowOffset:=0, columnOffset:=1).Activate
ActiveCell = ActiveCell.Value + 1
found17.Select
ActiveCell.Offset(rowOffset:=0, columnOffset:=1).Activate
ActiveCell = ActiveCell.Value + 1
found18.Select
ActiveCell.Offset(rowOffset:=0, columnOffset:=1).Activate
ActiveCell = ActiveCell.Value + 1
found19.Select
ActiveCell.Offset(rowOffset:=0, columnOffset:=1).Activate
ActiveCell = ActiveCell.Value + 1
found20.Select
ActiveCell.Offset(rowOffset:=0, columnOffset:=1).Activate
ActiveCell = ActiveCell.Value + 1
found21.Select
ActiveCell.Offset(rowOffset:=0, columnOffset:=1).Activate
ActiveCell = ActiveCell.Value + 1
found22.Select
ActiveCell.Offset(rowOffset:=0, columnOffset:=1).Activate
ActiveCell = ActiveCell.Value + 1
found23.Select
ActiveCell.Offset(rowOffset:=0, columnOffset:=1).Activate
ActiveCell = ActiveCell.Value + 1
found24.Select
ActiveCell.Offset(rowOffset:=0, columnOffset:=1).Activate
ActiveCell = ActiveCell.Value + 1
found25.Select
ActiveCell.Offset(rowOffset:=0, columnOffset:=1).Activate
ActiveCell = ActiveCell.Value + 1
found26.Select
ActiveCell.Offset(rowOffset:=0, columnOffset:=1).Activate
ActiveCell = ActiveCell.Value + 1
End Sub
Sub Userform_Initialize()
ComboBox1.SetFocus
Dim c As Range
With Sheets("Sheet1")
For Each c In .Range("A:A", .Range("A" & Rows.Count).End(xlUp))
If c.Value <> "" Then ComboBox1.AddItem c.Value
Next c
End With
Dim c1 As Range
With Sheets("Sheet1")
For Each c1 In .Range("A:A", .Range("A" & Rows.Count).End(xlUp))
If c1.Value <> "" Then ComboBox2.AddItem c1.Value
Next c1
End With
Dim c2 As Range
With Sheets("Sheet1")
For Each c2 In .Range("A:A", .Range("A" & Rows.Count).End(xlUp))
If c2.Value <> "" Then ComboBox3.AddItem c2.Value
Next c2
End With
Dim c3 As Range
With Sheets("Sheet1")
For Each c3 In .Range("A:A", .Range("A" & Rows.Count).End(xlUp))
If c3.Value <> "" Then ComboBox4.AddItem c3.Value
Next c3
End With
Dim c4 As Range
With Sheets("Sheet1")
For Each c4 In .Range("A:A", .Range("A" & Rows.Count).End(xlUp))
If c4.Value <> "" Then ComboBox5.AddItem c4.Value
Next c4
End With
Dim c5 As Range
With Sheets("Sheet1")
For Each c5 In .Range("A:A", .Range("A" & Rows.Count).End(xlUp))
If c5.Value <> "" Then ComboBox6.AddItem c5.Value
Next c5
End With
Dim c6 As Range
With Sheets("Sheet1")
For Each c6 In .Range("A:A", .Range("A" & Rows.Count).End(xlUp))
If c6.Value <> "" Then ComboBox7.AddItem c6.Value
Next c6
End With
Dim c7 As Range
With Sheets("Sheet1")
For Each c7 In .Range("A:A", .Range("A" & Rows.Count).End(xlUp))
If c7.Value <> "" Then ComboBox8.AddItem c7.Value
Next c7
End With
Dim c8 As Range
With Sheets("Sheet1")
For Each c8 In .Range("A:A", .Range("A" & Rows.Count).End(xlUp))
If c8.Value <> "" Then ComboBox9.AddItem c8.Value
Next c8
End With
Dim c9 As Range
With Sheets("Sheet1")
For Each c9 In .Range("A:A", .Range("A" & Rows.Count).End(xlUp))
If c9.Value <> "" Then ComboBox10.AddItem c9.Value
Next c9
End With
Dim c10 As Range
With Sheets("Sheet1")
For Each c10 In .Range("A:A", .Range("A" & Rows.Count).End(xlUp))
If c10.Value <> "" Then ComboBox11.AddItem c10.Value
Next c10
End With
Dim c11 As Range
With Sheets("Sheet1")
For Each c11 In .Range("A:A", .Range("A" & Rows.Count).End(xlUp))
If c11.Value <> "" Then ComboBox12.AddItem c11.Value
Next c11
End With
Dim c12 As Range
With Sheets("Sheet1")
For Each c12 In .Range("A:A", .Range("A" & Rows.Count).End(xlUp))
If c12.Value <> "" Then ComboBox13.AddItem c12.Value
Next c12
End With
Dim c13 As Range
With Sheets("Sheet1")
For Each c13 In .Range("A:A", .Range("A" & Rows.Count).End(xlUp))
If c13.Value <> "" Then ComboBox14.AddItem c13.Value
Next c13
End With
Dim c14 As Range
With Sheets("Sheet1")
For Each c14 In .Range("A:A", .Range("A" & Rows.Count).End(xlUp))
If c14.Value <> "" Then ComboBox14.AddItem c14.Value
Next c14
End With
Dim c15 As Range
With Sheets("Sheet1")
For Each c15 In .Range("A:A", .Range("A" & Rows.Count).End(xlUp))
If c15.Value <> "" Then ComboBox16.AddItem c15.Value
Next c15
End With
Dim c16 As Range
With Sheets("Sheet1")
For Each c16 In .Range("A:A", .Range("A" & Rows.Count).End(xlUp))
If c16.Value <> "" Then ComboBox17.AddItem c16.Value
Next c16
End With
Dim c17 As Range
With Sheets("Sheet1")
For Each c17 In .Range("A:A", .Range("A" & Rows.Count).End(xlUp))
If c17.Value <> "" Then ComboBox18.AddItem c17.Value
Next c17
End With
Dim c18 As Range
With Sheets("Sheet1")
For Each c18 In .Range("A:A", .Range("A" & Rows.Count).End(xlUp))
If c18.Value <> "" Then ComboBox19.AddItem c18.Value
Next c18
End With
Dim c19 As Range
With Sheets("Sheet1")
For Each c19 In .Range("A:A", .Range("A" & Rows.Count).End(xlUp))
If c19.Value <> "" Then ComboBox20.AddItem c19.Value
Next c19
End With
Dim c20 As Range
With Sheets("Sheet1")
For Each c20 In .Range("A:A", .Range("A" & Rows.Count).End(xlUp))
If c20.Value <> "" Then ComboBox21.AddItem c20.Value
Next c20
End With
Dim c21 As Range
With Sheets("Sheet1")
For Each c21 In .Range("A:A", .Range("A" & Rows.Count).End(xlUp))
If c21.Value <> "" Then ComboBox22.AddItem c21.Value
Next c21
End With
Dim c22 As Range
With Sheets("Sheet1")
For Each c22 In .Range("A:A", .Range("A" & Rows.Count).End(xlUp))
If c22.Value <> "" Then ComboBox23.AddItem c22.Value
Next c22
End With
Dim c23 As Range
With Sheets("Sheet1")
For Each c23 In .Range("A:A", .Range("A" & Rows.Count).End(xlUp))
If c23.Value <> "" Then ComboBox24.AddItem c23.Value
Next c23
End With
Dim c24 As Range
With Sheets("Sheet1")
For Each c24 In .Range("A:A", .Range("A" & Rows.Count).End(xlUp))
If c24.Value <> "" Then ComboBox25.AddItem c24.Value
Next c24
End With
Dim c25 As Range
With Sheets("Sheet1")
For Each c25 In .Range("A:A", .Range("A" & Rows.Count).End(xlUp))
If c25.Value <> "" Then ComboBox26.AddItem c25.Value
Next c25
End With
Dim c26 As Range
With Sheets("Sheet1")
For Each c26 In .Range("A:A", .Range("A" & Rows.Count).End(xlUp))
If c26.Value <> "" Then ComboBox27.AddItem c26.Value
Next c26
End With
End Sub
Display More