MistakesWereMade
Board Regular
- Joined
- May 22, 2019
- Messages
- 103
I try to open my UserForm and for some reason it is erroring saying permission denied... Any ideas?
Error says it has to do with worksheet code line 'UserForm1.Show'
I have very similar issue to this guy here... We used the same tutorial and wanted our program to allow more than just the first selection.
https://stackoverflow.com/questions...value-only-excel-vba?answertab=active#tab-top
The tutorial we both used was:
https://trumpexcel.com/excel-drop-down-list-with-search-suggestions/
Worksheet Code:
Userform Code:
Error says it has to do with worksheet code line 'UserForm1.Show'
I have very similar issue to this guy here... We used the same tutorial and wanted our program to allow more than just the first selection.
https://stackoverflow.com/questions...value-only-excel-vba?answertab=active#tab-top
The tutorial we both used was:
https://trumpexcel.com/excel-drop-down-list-with-search-suggestions/
Worksheet Code:
Code:
Private Sub Workbook_Open()
Application.Visible = True
UserForm1.Show
End Sub
Userform Code:
Code:
Dim ListCB As Variant
Private Sub UserForm_Initialize()
Dim TmpText As String
If Not IsArray(Sheets("Data").Range(Names("DropDownList"))) Then
temptext = Worksheets("Data").Range("E2").Value
Worksheets("Data").Range("E2").Value = ""
End If
ListCB = Sheets("Data").Range(Names("DropDownList"))
If Len(temptext) Then Worksheets("Data").Range("E2").Value = temptext
GetCBList
End Sub
Sub GetCBList()
Dim b As Variant, i As Long
Dim a() As Variant: ReDim a(UBound(ListCB))
For Each b In ListCB
If Len(b) Then
If InStr(1, b, ComboBox1.Value, vbTextCompare) > 0 Or ComboBox1.Value = "" Then: a(i) = b: i = i + 1
End If
Next
If i > 0 Then ReDim Preserve a(i - 1)
ComboBox1.List = a
End Sub
Private Sub ComboBox1_Change()
GetCBList
ComboBox1.DropDown
Worksheets("Data").Range("E2").Value = ComboBox1.Value
End Sub