Permission Denied error when I try to run my code

2020Rivalry

New Member
Joined
Apr 12, 2022
Messages
35
Office Version
  1. 365
Platform
  1. 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!

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
 

Excel Facts

Copy PDF to Excel
Select data in PDF. Paste to Microsoft Word. Copy from Word and paste to Excel.

Forum statistics

Threads
1,215,046
Messages
6,122,855
Members
449,096
Latest member
Erald

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top