Add in SwitchSheet: Quay lại các sheet đã xem trước đó bằng phím tắt

Liên hệ QC
Em dùng excel 2019 32b, khi load add in và dùng tổ hợp phím (Alt+Q) thì thấy hiện lên hình dưới mà không thể quay lại sheet trước đó, nhờ anh xem giúp.View attachment 234211
Các phiên bản sau này "Alt + q" là phím tắt "tell me what you want to do..." và không thể đặt phím tắt đè lên. Bạn có thể dùng tổ hợp phím tắt khác theo hướng dẫn dưới đây.
Bạn sử dụng file này. Nếu muốn thay đổi phím tắt thì thay đổi các dòng khai báo đầu trong module M01 theo hướng dẫn được ghi chú trong code.
 
Option Explicit
Public Const CtrlKey As Long = 17, AltKey As Long = 18
Public Const AltOrCtrl As Long = AltKey 'CtrlKey neu dung phim Ctrl - AltKey neu dung phim Alt
Public Const Key As String = "a" 'Thay doi theo nhu cau su dung
Public App As clsExcelApp
Private Sub Auto_Open()
Application.OnKey IIf(AltOrCtrl = AltKey, "^", "%") & "{" & Key & "}", "SwitchSheet"
Set App = New clsExcelApp
App.Wrap Application
End Sub
Private Sub Auto_Close()
Application.OnKey IIf(AltOrCtrl = AltKey, "^", "%") & "{" & Key & "}"
Set App = Nothing
End Sub
Private Sub SwitchSheet()
On Error Resume Next
Dim i As Long
For i = 0 To Frm_SheetsInfo.SwitchSheetLB.ListCount - 1
If Frm_SheetsInfo.SwitchSheetLB.List(i, 0) = ActiveWorkbook.Name Then
Dim j As Long, Array_Ordinal
If InStr(1, Frm_SheetsInfo.SwitchSheetLB.List(i, 1) & "/", ActiveSheet.Name & "/", vbTextCompare) <> 1 Then
Frm_SheetsInfo.SwitchSheetLB.List(i, 1) = Frm_SwitchSheet.Get_Sheets_Ordinal(ActiveWorkbook, Frm_SheetsInfo.SwitchSheetLB.List(i, 1))
End If
Array_Ordinal = Split(Frm_SheetsInfo.SwitchSheetLB.List(i, 1), "/")
For j = LBound(Array_Ordinal, 1) To UBound(Array_Ordinal, 1)
If ActiveWorkbook.Sheets(Array_Ordinal(j)) Is Nothing Then
GoTo Next_j
ElseIf ActiveWorkbook.Sheets(Array_Ordinal(j)).Visible = xlSheetVisible Then
Frm_SwitchSheet.LB_Sheets.AddItem Array_Ordinal(j)
End If
Next_j:
Next
If Frm_SwitchSheet.LB_Sheets.ListCount > 1 Then
Frm_SwitchSheet.LB_Sheets.ListIndex = 1
If Frm_SwitchSheet.LB_Sheets.ListCount < 12 Then
Frm_SwitchSheet.LB_Sheets.Height = 2 + Frm_SwitchSheet.LB_Sheets.ListCount * 10
Frm_SwitchSheet.Height = 21.75 + Frm_SwitchSheet.LB_Sheets.ListCount * 10
End If
Frm_SwitchSheet.Show
Else
Unload Frm_SwitchSheet
Frm_SwitchSheet.LB_Sheets.ListIndex = j
If Frm_SwitchSheet.LB_Sheets.ListCount > 1 Then
If Frm_SwitchSheet.LB_Sheets.ListCount < 12 Then
Frm_SwitchSheet.LB_Sheets.Height = 2 + Frm_SwitchSheet.LB_Sheets.ListCount * 10
Frm_SwitchSheet.Height = 21.75 + Frm_SwitchSheet.LB_Sheets.ListCount * 10
End If
Frm_SwitchSheet.Show
Else
Unload Frm_SwitchSheet
End If
End If
Exit Sub
End If
Next
End Sub
 
Em dùng office 2016 nhưng không sử dụng Add in được, đều báo lỗi
Thử tất cả các file từ file dành cho 64 bit, tới file dành cho Office 2016 cũng không được

Sau hơn 8 trang trao dổi, Anh/Chị có thể gửi lại file hoạt động tốt cho Office 2016 không ạ?
 
Tôi nghĩ đa số những người dùng máy tính thường xuyên sử dụng phím tắt Alt + Tab để mở lại cửa sổ gần nhất vì nó rất tiện lợi. Tuy nhiên, trên Excel khi ta muốn xem lại sheet vừa xem thì phải tìm và chọn. Đối với những file có nhiều sheet thì rất mất thời gian. Vì vậy, tôi tạo ra Addin này.

Công dụng duy nhất: Mở lại các Sheet đã mở gần nhất bằng phím tắt Alt + q (tôi chọn phím q vì phím q gần với phím tab, các bạn có thể sửa lại trong code)

Hy vọng Addin này sẽ giúp tiết kiệm thời gian cho những người thường xuyên làm việc trên Excel.
Bạn ơi, mình rất mong bạn hỗ trợ mình cai cái switchsheet nay, minh cài hoài mà ko thấy xài được, giúp mình với
 
Web KT

Bài viết mới nhất

Back
Top Bottom