|
' 得到所有的sheet页名称,并加上超连接
Dim totalnum As Integer
Dim tar_sheet As String
Dim sheetName As String
totalnum = Worksheets.Count
Worksheets(1).Activate
Cells.Interior.Color = RGB(224, 232, 207)
Range("B:B").Select
Selection.NumberFormatLocal = "@"
' 从2开始就是不带“目录”Sheet页,如果要带,则从1开始
For i = 2 To totalnum
sheetName = Worksheets(i).Name
sheetName = Replace(sheetName, " ", "")
Cells(i, 2) = sheetName
tar_sheet = "'" & sheetName & "'"
Cells(i, 2).Select
ActiveSheet.Hyperlinks.Add Anchor:=Selection, Address:="", SubAddress:= _
tar_sheet & "!A1", TextToDisplay:=sheetName
Next
ActiveSheet.UsedRange.Select
With Selection
.HorizontalAlignment = xlLeft
.VerticalAlignment = xlCenter
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With
With Selection.Font
.Name = "微软雅黑"
.FontStyle = "常规"
.Size = 13
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleSingle
.ThemeColor = xlThemeColorHyperlink
.TintAndShade = 0
.ThemeFont = xlThemeFontNone
End With
给你一段代码,也是我网上抄的。测试可用 |
评分
-
查看全部评分
|