Mình bị báo lỗi 424 ( dòng màu đỏ ), không biết vì sao. Giúp mình với !!!
Mã:
Public User_Form As DialogSheet
Sub TaoUserForm()
On Error GoTo Thoat
Dim Bangtinh As Worksheet
Application.ScreenUpdating = False
Set User_Form = ActiveWorkbook.DialogSheets.Add
With User_Form.DialogFrame
.Left = 0
.Top = 0
.Height = 120
.Width = 160
End With
User_Form.Buttons(1).Caption = ChrW(272) & "óng"
User_Form.Buttons(1).Left = 100
With User_Form.ListBoxes.Add(5, 20, 90, 90)
For Each Bangtinh In ActiveWorkbook.Worksheets
If Bangtinh.Visible Then .AddItem Bangtinh.Name
Next Bangtinh
.ListIndex = 1
.OnAction = "DisplaySheet"
End With
User_Form.DialogFrame.Caption = "Danh Sach Sheet"
User_Form.Visible = False
Application.ScreenUpdating = True
If User_Form.Show Then
Worksheets(User_Form.ListBoxes(1).List(User_Form.ListBoxes(1).ListIndex)).Activate
End If
Application.DisplayAlerts = False
User_Form.Delete
Set Bangtinh = Nothing
Set User_Form = Nothing
Application.ScreenUpdating = True
Thoat:
End Sub
Private Sub DisplaySheet()
Worksheets(User_Form.ListBoxes(1).List(User_Form.ListBoxes(1).ListIndex)).Activate
Range("A1").Select
End Sub
Sửa lần cuối bởi điều hành viên: