Как просмотреть все метки листа в MS Excel?

509
Ale

У меня есть файл MS Excel со многими листами, и мне нужно перейти к ним.

Как я могу перечислить все метки и перейти к определенной?

0
Внизу, где находятся все названия листов, есть также кнопка для левой и правой стороны. Разве этого не достаточно, чтобы пролистать доступные листы? LPChip 8 лет назад 0
Или щелкните правой кнопкой мыши на области, которую указал @LPChip. SΛLVΘ 8 лет назад 0
@LPChip бесполезен, потому что у меня много листов с очень длинными именами Ale 8 лет назад 0

1 ответ на вопрос

0
David

Interesting. I've just written three macros which will do this reasonably well. The first macro generates a summary sheet (named sh_summary) at the end of your workbook, and selects it. Then, from this new summary sheet, you select one of the sheet names that you want (e.g. select cell A2), and then launch the second macro which will select/navigate to the sheet you chose. The third macro will take you back to the summary sheet. The 2nd + 3rd macros should be shortcutted, for fast navigation.

1:

Sub findSheets() Dim sheetNum As Integer Dim i As Integer Dim theSh(999) 'count sheets: sheetNum = ActiveWorkbook.Worksheets.Count 'check for a summary sheet and delete it if found: For i = 1 To sheetNum If ActiveWorkbook.Worksheets(i).Name = "sh_summary" Then Application.DisplayAlerts = False ActiveWorkbook.Worksheets(i).Delete Application.DisplayAlerts = True End If Next i 'count sheets again: sheetNum = ActiveWorkbook.Worksheets.Count 'get sheet names For i = 1 To sheetNum theSh(i) = ActiveWorkbook.Worksheets(i).Name Next i 'create summary sheet: Sheets.Add After:=Sheets(Sheets.Count) Sheets(Sheets.Count).Select Sheets(Sheets.Count).Name = "sh_summary" 'print sheet names on summary sheet: For i = 1 To sheetNum Cells(1, 1).Value = "Worksheet summary:" Cells((1 + i), 1).Value = theSh(i) Next i End Sub 

2:

Sub navToSheet() On Error Resume Next ActiveWorkbook.Worksheets(ActiveCell.Value).Select If Err.Number <> 0 Then MsgBox "Can't find sheet - select and try again." Err.Clear End If End Sub 

3:

Sub navToSummary() On Error Resume Next ActiveWorkbook.Worksheets("sh_summary").Select If Err.Number <> 0 Then MsgBox "Can't find summary sheet." Err.Clear End If End Sub 

Похожие вопросы