Sub 在目录表建立本工作簿中各表链接目录()
Dim s%, rng As Range
On Error Resume Next
Sheets("目录").Activate
If Err = 0 Then
Sheets("目录").UsedRange.Delete
Else
Sheets.Add
ActiveSheet.Name = "目录"
End If
For i = 1 To Sheets.Count
If Sheets(i).Name <> "目录" Then
s = s + 1
Set rng = Sheets("目录").Cells(((s - 1) Mod 20) + 1, (s - 1) \ 20 + 1 + 1)
rng = Format(s, " 0") & ". " & Sheets(i).Name
ActiveSheet.Hyperlinks.Add rng, "#" & Sheets(i).Name & "!A1", ScreenTip:=Sheets(i).Name
End If
Next
Sheets("目录").Range("b:iv").EntireColumn.ColumnWidth = 20
End Sub
|
|
susan