C
Corey
I am getting anerror with the below code:
Is there a way i can get it to use the ActiveCell that triggered the macro
here ??
Private Sub ComboBox1_DropButtonClick()
Application.ScreenUpdating = False
If ComboBox1.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(-1, 2).Text =
Sheet5.Range("B2").Value And IsNumeric(Trim(Mid(.Cells(myrow, 1), 2))) =
True Then
For i = 2 To 22
If Cells(myrow, 3).Offset(i, 0).Value <> "" Then
If Sheet5.ActiveCell = .Cells(myrow, 1).Offset(0, 0).Value Then
'<=========== Error with ActiveCell
ComboBox1.AddItem Cells(myrow, 3).Offset(i, 0)
ComboBox1.List(ComboBox1.ListCount - 1, 1) = Cells(myrow, 3).Offset(i,
0).Address
End If
Next i
End If
End If
Next
End With
Application.ScreenUpdating = True
End Sub
Corey....
Is there a way i can get it to use the ActiveCell that triggered the macro
here ??
Private Sub ComboBox1_DropButtonClick()
Application.ScreenUpdating = False
If ComboBox1.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(-1, 2).Text =
Sheet5.Range("B2").Value And IsNumeric(Trim(Mid(.Cells(myrow, 1), 2))) =
True Then
For i = 2 To 22
If Cells(myrow, 3).Offset(i, 0).Value <> "" Then
If Sheet5.ActiveCell = .Cells(myrow, 1).Offset(0, 0).Value Then
'<=========== Error with ActiveCell
ComboBox1.AddItem Cells(myrow, 3).Offset(i, 0)
ComboBox1.List(ComboBox1.ListCount - 1, 1) = Cells(myrow, 3).Offset(i,
0).Address
End If
Next i
End If
End If
Next
End With
Application.ScreenUpdating = True
End Sub
Corey....