abdelfattah
Well-known Member
- Joined
- May 3, 2019
- Messages
- 1,438
- Office Version
- 2019
- 2010
- Platform
- Windows
hello
i have sheet contains data from a3 : g1000 and userform contains combobox1 and listbox
the proplem when i run userform i can't access to it an show me error run time error70 permission is denied
i hope any body help
i have sheet contains data from a3 : g1000 and userform contains combobox1 and listbox
the proplem when i run userform i can't access to it an show me error run time error70 permission is denied
i hope any body help
VBA Code:
Option Explicit
Dim myData As Range
Private Sub ComboBox1_Change()
Me.ListBox1.ListIndex = Me.ComboBox1.ListIndex
Dim mySearchRng As Range
Dim myFindRng As Range
Dim myValToFind As String
With Worksheets("sheet3")
myValToFind = ComboBox1.Value
Set mySearchRng = .Columns("g")
End With
Set myFindRng = mySearchRng.Find(What:=myValToFind, _
LookIn:=xlFormulas, _
LookAt:=xlWhole, _
SearchOrder:=xlByRows, _
SearchDirection:=xlNext, _
MatchCase:=False)
ListBox1.AddItem
With ListBox1
.List(.ListCount - 1, 0) = myFindRng.Value 'Data from Col A
.List(.ListCount - 1, 1) = myFindRng.Offset(0, 2).Value 'Data from Col B
.List(.ListCount - 1, 2) = myFindRng.Offset(0, 3).Value 'Data from Col C
.List(.ListCount - 1, 3) = myFindRng.Offset(0, 4).Value 'Data from Col D
.List(.ListCount - 1, 4) = myFindRng.Offset(0, 5).Value 'Data from Col E
.List(.ListCount - 1, 5) = myFindRng.Offset(0, 6).Value 'Data from Col f
.List(.ListCount - 1, 6) = myFindRng.Offset(0, 7).Value 'Data from Col g
End With
End Sub
Private Sub UserForm_Initialize()
Set myData = Sheet3.Range("g3").CurrentRegion
Me.ComboBox1.List = myData.Offset(7).Value
Me.ListBox1.ColumnCount = 7
Me.ListBox1.List = Me.ComboBox1.List
End Sub