C
Corey
Without getting in the reasons and specifics the following part of the below
code "For i = 2 To 22" refered to data in rows 2 to 22.
But i have changed the way the data is stored, and it is now stored on a
single row, but not in adjacent columns.
The data is now in column 11,20,29 etc(every 9 columns)
Is there a way i could modify the "For i = " to refer to all values in the
single row specified columns instead of in the rows 2-22 as previously set?
Corey....
******************************************
Private Sub ComboBox6_DropButtonClick()
Application.ScreenUpdating = False
If ComboBox6.ListCount > 0 Then Exit Sub
'Place the References in here for the Roll Numbers and Lengths
Dim LastCell As Long
Dim myrow As Long
On Error Resume Next
LastCell = Worksheets("InspectionData").Cells(Rows.Count,
"A").End(xlUp).Row
With ActiveWorkbook.Worksheets("InspectionData")
For myrow = 2 To LastCell
If .Cells(myrow, 1) <> "" Then
If .Cells(myrow, 1).Offset(, 3).Text = ComboBox28.Text And
..Cells(myrow, 1).Offset(, 5).Text = ComboBox1.Text And .Cells(myrow,
1).Offset(0, 0).Value = ComboBox5.Text Then
For i = 2 To 22
If Cells(myrow, 1).Offset(, 11).Font.Strikethrough =
False And Cells(myrow, 1).Offset(, 11).Value <> "" Then
ComboBox6.AddItem Cells(myrow, 1).Offset(, 11)
ComboBox6.List(ComboBox6.ListCount - 1, 1) = Cells(myrow, 13).Offset(,
11).Address
End If
Next i
End If
End If
Next
End With
Application.ScreenUpdating = True
End Sub
****************************************
code "For i = 2 To 22" refered to data in rows 2 to 22.
But i have changed the way the data is stored, and it is now stored on a
single row, but not in adjacent columns.
The data is now in column 11,20,29 etc(every 9 columns)
Is there a way i could modify the "For i = " to refer to all values in the
single row specified columns instead of in the rows 2-22 as previously set?
Corey....
******************************************
Private Sub ComboBox6_DropButtonClick()
Application.ScreenUpdating = False
If ComboBox6.ListCount > 0 Then Exit Sub
'Place the References in here for the Roll Numbers and Lengths
Dim LastCell As Long
Dim myrow As Long
On Error Resume Next
LastCell = Worksheets("InspectionData").Cells(Rows.Count,
"A").End(xlUp).Row
With ActiveWorkbook.Worksheets("InspectionData")
For myrow = 2 To LastCell
If .Cells(myrow, 1) <> "" Then
If .Cells(myrow, 1).Offset(, 3).Text = ComboBox28.Text And
..Cells(myrow, 1).Offset(, 5).Text = ComboBox1.Text And .Cells(myrow,
1).Offset(0, 0).Value = ComboBox5.Text Then
For i = 2 To 22
If Cells(myrow, 1).Offset(, 11).Font.Strikethrough =
False And Cells(myrow, 1).Offset(, 11).Value <> "" Then
ComboBox6.AddItem Cells(myrow, 1).Offset(, 11)
ComboBox6.List(ComboBox6.ListCount - 1, 1) = Cells(myrow, 13).Offset(,
11).Address
End If
Next i
End If
End If
Next
End With
Application.ScreenUpdating = True
End Sub
****************************************