Hi i have been building this listbox with some fantastic help from this board. I use the following code to capture a date a place this in column h of the selected listbox item.
This works fine as long as i have the full range displayed in the listbox. I am using this code to filter the data based on a value in a combobox which is:-
When i enter the date, after the data has been filtered it does not match from the selected item, but some other row in the dataset.
I can post the full code if needed. If anyone can help or point me in the right direction. I would be most obliged.
Thank you in advance.
Ally.
Code:
Private Sub EnterDate_Click()
Dim lastrow As Long
With Worksheets("data")
.Range("H" & ListBox1.ListIndex + 2).Value = TextBox1.Value
.Range("l" & ListBox1.ListIndex + 2).Value = ""
End With
Call filterwithdates
Call copytocompleted
Call clearfiltercontents
Call deleteemptyrows
'
Call UserForm_Initialize
End Sub
This works fine as long as i have the full range displayed in the listbox. I am using this code to filter the data based on a value in a combobox which is:-
Code:
Private Sub CommandButton3_Click()
Dim Rng As Range
Dim Dn As Range
Dim Ac As Integer
With ListBox1
.Clear
.ColumnCount = 9
.ColumnWidths = "80,80,80,85,85,85,85,85,85"
End With
With Worksheets("Data")
Set Rng = .Range(.Range("fullrange"), .Range("A" & Rows.Count).End(xlUp))
End With
For Each Dn In Rng
If Trim(Dn.Offset(, 1)) = ComboBox1.Value Then
With ListBox1
.AddItem Trim(Dn)
For Ac = 1 To 8
.List(.ListCount - 1, Ac) = Dn.Offset(, Ac)
Next Ac
End With
End If
Next Dn
End Sub
When i enter the date, after the data has been filtered it does not match from the selected item, but some other row in the dataset.
I can post the full code if needed. If anyone can help or point me in the right direction. I would be most obliged.
Thank you in advance.
Ally.