|
- Sub 提取班级表名并建立链接()
- '建立目录
- Dim 行%, 列%, x%, i%, j%
- On Error Resume Next
- Application.ScreenUpdating = False
- Application.DisplayAlerts = False
- Sheets("目录").Delete
- Application.DisplayAlerts = True
- Sheets.Add(before:=Sheets(1)).Name = "目录"
- For x = 1 To Sheets.Count
- 行 = ((x - 1) Mod 20) + 1
- 列 = (Int((x - 1) / 20) + 1) * 2 - 1
- Cells(行, 列) = "=hyperlink(""#'" & Sheets(x).Name & "'!A1"",""" & Sheets(x).Name & """)"
- Next x
- Application.ScreenUpdating = True
- ' 建立返回目录链接
- For i = 2 To Sheets.Count
- j = Sheets(i).UsedRange.Columns.Count '获取工作表使用的列数
- If Cells(1, j).Text <> "返回目录" Then
- Sheets(i).Hyperlinks.Add Anchor:=Sheets(i).Cells(1, j + 1), Address:="", SubAddress:= _
- "目录!A1", TextToDisplay:="返回目录"
- End If
- Next
- Sheets("目录").Rows().RowHeight = 18
- Sheets("目录").Columns().ColumnWidth = 18
- End Sub
复制代码 |
|