C
Corey
I have the following code that lists Numerical Values in Column C that are >= to a Textbox Value,
But
As the Values are Anywhere Between 2-22 rows Below the Value in Column A,
i have been unable to gain this value from Column A and be able to use this to be the Value of a
Label when a CommandButton is pressed.
The value is Identified in the Following Code, But i think i need to go Backwards to Find the Value,
and have not been able to do this?
Private Sub TextBox1_Change()
Application.ScreenUpdating = False
ListBox3.Clear
If TextBox1.Value <> "" Then
Dim lastcell As Long
Dim myrow As Long
Dim i As Long
On Error Resume Next
lastcell = Worksheets("InspectionData").Cells(Rows.Count, "A").End(xlUp).Row
With ActiveWorkbook.Worksheets("InspectionData")
For myrow = 1 To lastcell
If .Cells(myrow, 1) <> "" Then ' <=== THIS IS THE VALUE HERE I NEED TO IDENTIFY
If .Cells(myrow, 1).Offset(-1, 2).Value = ListBox1.Value Then
If .Cells(myrow, 1).Offset(-1, 6).Value = ListBox2.Value Then
For i = 2 To 22
If .Cells(myrow, 3).Offset(i, 0).Font.Strikethrough = False And Cells(myrow, 3).Offset(i,
0).Value <> "" _
And IsNumeric(.Cells(myrow, 3).Offset(i, 0)) Then
If .Cells(myrow, 3).Offset(i, 0).Value <> "" And .Cells(myrow, 3).Offset(i, 0).Value >=
Val(TextBox1.Value) Then
ListBox3.AddItem Cells(myrow, 3).Offset(i, 0)
ListBox3.List(ListBox3.ListCount - 1, 1) = Cells(myrow, 3).Offset(i, 0).Address
End If
End If
Next i
End If
End If
End If
Next
End With
End If
Label8 = ListBox3.ListCount
Application.ScreenUpdating = True
End Sub
Want to do something like:
But
As the Values are Anywhere Between 2-22 rows Below the Value in Column A,
i have been unable to gain this value from Column A and be able to use this to be the Value of a
Label when a CommandButton is pressed.
The value is Identified in the Following Code, But i think i need to go Backwards to Find the Value,
and have not been able to do this?
Private Sub TextBox1_Change()
Application.ScreenUpdating = False
ListBox3.Clear
If TextBox1.Value <> "" Then
Dim lastcell As Long
Dim myrow As Long
Dim i As Long
On Error Resume Next
lastcell = Worksheets("InspectionData").Cells(Rows.Count, "A").End(xlUp).Row
With ActiveWorkbook.Worksheets("InspectionData")
For myrow = 1 To lastcell
If .Cells(myrow, 1) <> "" Then ' <=== THIS IS THE VALUE HERE I NEED TO IDENTIFY
If .Cells(myrow, 1).Offset(-1, 2).Value = ListBox1.Value Then
If .Cells(myrow, 1).Offset(-1, 6).Value = ListBox2.Value Then
For i = 2 To 22
If .Cells(myrow, 3).Offset(i, 0).Font.Strikethrough = False And Cells(myrow, 3).Offset(i,
0).Value <> "" _
And IsNumeric(.Cells(myrow, 3).Offset(i, 0)) Then
If .Cells(myrow, 3).Offset(i, 0).Value <> "" And .Cells(myrow, 3).Offset(i, 0).Value >=
Val(TextBox1.Value) Then
ListBox3.AddItem Cells(myrow, 3).Offset(i, 0)
ListBox3.List(ListBox3.ListCount - 1, 1) = Cells(myrow, 3).Offset(i, 0).Address
End If
End If
Next i
End If
End If
End If
Next
End With
End If
Label8 = ListBox3.ListCount
Application.ScreenUpdating = True
End Sub
Want to do something like: