C
Corey
The code below fails to populate Listboxes 5-7 due to the date formating of
the sheet value and the Listbox4.
The sheet value ((myrow,4) is in a ddd dd mmm yy format, where the Listbox
keeps formatting to a mm/dd/yyyy.
I have tried to format the listbox4 before and after it is populated by:
ListBox4.Value = Format(.Cells(myrow, 4).Offset(, 3).Value , "dd/mm/yyyy")
But i still get NO result with the below due to a MATCH found but NOT
recognised at trhe highlighted line below.
Private Sub ListBox4_Click()
Application.ScreenUpdating = False
TextBox1.Value = ""
ListBox5.Clear
ListBox7.Clear
ListBox6.Clear
ListBox7.Clear
Dim LastCell As Long
Dim myrow As Long
LastCell = Worksheets("Data").Cells(Rows.Count, "D").End(xlUp).Row
With ActiveWorkbook.Worksheets("Data")
For myrow = 1 To LastCell
If .Cells(myrow, 4).Offset(, -3).Value <> "" And .Cells(myrow,
4).Offset(, -3).Value = ListBox1.Value And _
ListBox2.Value = .Cells(myrow, 4).Offset(, 3).Value And _
ListBox4.Value = .Cells(myrow, 4).Value Then ' <===== HERE
ListBox7.AddItem .Cells(myrow, 4).Offset(, 231).Value
ListBox5.AddItem .Cells(myrow, 4).Offset(, 230).Value
ListBox6.AddItem .Cells(myrow, 4).Offset(, 7).Value
End If
Next
End With
Sheets("Opening Page").Activate
Application.ScreenUpdating = True
End Sub
The code simply reducing possible senarios to ensure the correct row is
chaosen to be viewed in a sheet.
the sheet value and the Listbox4.
The sheet value ((myrow,4) is in a ddd dd mmm yy format, where the Listbox
keeps formatting to a mm/dd/yyyy.
I have tried to format the listbox4 before and after it is populated by:
ListBox4.Value = Format(.Cells(myrow, 4).Offset(, 3).Value , "dd/mm/yyyy")
But i still get NO result with the below due to a MATCH found but NOT
recognised at trhe highlighted line below.
Private Sub ListBox4_Click()
Application.ScreenUpdating = False
TextBox1.Value = ""
ListBox5.Clear
ListBox7.Clear
ListBox6.Clear
ListBox7.Clear
Dim LastCell As Long
Dim myrow As Long
LastCell = Worksheets("Data").Cells(Rows.Count, "D").End(xlUp).Row
With ActiveWorkbook.Worksheets("Data")
For myrow = 1 To LastCell
If .Cells(myrow, 4).Offset(, -3).Value <> "" And .Cells(myrow,
4).Offset(, -3).Value = ListBox1.Value And _
ListBox2.Value = .Cells(myrow, 4).Offset(, 3).Value And _
ListBox4.Value = .Cells(myrow, 4).Value Then ' <===== HERE
ListBox7.AddItem .Cells(myrow, 4).Offset(, 231).Value
ListBox5.AddItem .Cells(myrow, 4).Offset(, 230).Value
ListBox6.AddItem .Cells(myrow, 4).Offset(, 7).Value
End If
Next
End With
Sheets("Opening Page").Activate
Application.ScreenUpdating = True
End Sub
The code simply reducing possible senarios to ensure the correct row is
chaosen to be viewed in a sheet.