This is Listbox Loading when Form Initiate:
This is Sort Button Click Event:
While clicking that Sort button (Refer Image), got an error like "Permission Denied - Error Code: 70"
Kindly anyone help me to solve this issue
VBA Code:
Sub LoadDataList()
On Error Resume Next
Dim oLastRow As Long
Dim oMatchFoundIndex As Long
Dim oCounter As Long
With oCurrentSheet
oLastRow = .Range("A65000").End(xlUp).Row
lstData.RowSource = .Range("A3:B" & oLastRow).Address(external:=True)
End With
On Error GoTo 0
End Sub
This is Sort Button Click Event:
VBA Code:
Private Sub cmdSort_AtoZ_Click()
Dim i As Long
Dim j As Long
Dim sTemp As String
Dim sTemp2 As String
Dim LbList As Variant
'Store the list in an array for sorting
LbList = frmProductCategory.lstData.List
'Bubble sort the Array
'Bubble sort the array on the first value
For i = LBound(LbList, 1) To UBound(LbList, 1) - 1
For j = i + 1 To UBound(LbList, 1)
If LbList(i, 0) > LbList(j, 0) Then
'Swap the first value
sTemp = LbList(i, 0)
LbList(i, 0) = LbList(j, 0)
LbList(j, 0) = sTemp
'Swap the second value
sTemp2 = LbList(i, 1)
LbList(i, 1) = LbList(j, 1)
LbList(j, 1) = sTemp2
End If
Next j
Next i
'Repopulate with the sorted list
Me.lstData.List = LbList
On Error GoTo 0
End Sub
While clicking that Sort button (Refer Image), got an error like "Permission Denied - Error Code: 70"
Kindly anyone help me to solve this issue