2020Rivalry
New Member
- Joined
- Apr 12, 2022
- Messages
- 35
- Office Version
- 365
- Platform
- Windows
I created a userform recently, inside of it got 14 columns. Now I want to use a textbox to filter the data based on one single column. But the error message: Permission Denied keep popping out. Any helps?
Thank you very much!
Thank you very much!
VBA Code:
Private Sub txtSearch_Change()
Dim myList() As Variant
Dim X As Long
Dim Y As Long
Dim FoundSomething As Boolean
Y = 0
For X = 6 To Sheets("Sheet1").Range("A" & Rows.Count).End(xlUp).Row
If InStr(1, UCase(Sheets("Sheet1").Range("A" & X).Value), UCase(txtSearch)) > 0 Then
FoundSomething = True
ReDim Preserve myList(Y)
myList(Y) = Sheets("Sheet1").Range("A" & X).Text
Y = Y + 1
End If
Next
If FoundSomething Then
ListBox.ColumnCount = 14
ListBox.ColumnHeads = True
ListBox.ColumnWidths = "55,220,100,100,70,70,70,55,130,80,80,70,150,150"
[COLOR=rgb(250, 197, 28)][B] [/B][/COLOR][COLOR=rgb(71, 85, 119)][B]Me.ListBox.List = myList()[/B][/COLOR]
Else
Call Refresh_data
End If
End Sub