HI,
I am using a textbox to enter a value and a list box is then filtered on the data entered in the textbox, it works fine the first time when I run through the userform, then I always get a permission denied error in this code
I am placing the list for the listbox by replacing the entries in the column in the source data sheet, by using advance filter on the input sheet and then copying over the new list.
I am at a loss as to why I get the permission denied after I enter a record on the sheet1.
Hope this is of use, Rob.
I am using a textbox to enter a value and a list box is then filtered on the data entered in the textbox, it works fine the first time when I run through the userform, then I always get a permission denied error in this code
Code:
Private Sub FilterList(iCtrl As Long, sText As String)
Dim iRow As Long
Dim sCrit As String
sCrit = "*" & UCase(sText) & "*"
With Me.Listbox1
Sheets("Source Data").Activate
Me.Listbox1.Clear
filfin = Range("d5").End(xlDown).Row 'here is the error
Me.Listbox1.List = Range("d5:d" & filfin).Value
For iRow = .ListCount - 1 To 0 Step -1
If Not UCase(.List(iRow, iCtrl)) Like sCrit Then
.RemoveItem iRow
End If
Next iRow
End With
End Sub
Code:
filfin = Range("d5").End(xlDown).Row
I am placing the list for the listbox by replacing the entries in the column in the source data sheet, by using advance filter on the input sheet and then copying over the new list.
I am at a loss as to why I get the permission denied after I enter a record on the sheet1.
Hope this is of use, Rob.