在excel中如何把窗口名称栏分两行?
发布网友
发布时间:2022-10-19 09:43
我来回答
共1个回答
热心网友
时间:2024-04-16 14:56
虽然是抄袭,希望你能有用
你可以利用超级链接的方式建立一个索引主工作表,那样就会方便很多
追问
具体怎样弄?
回答
Sub 目录()
On Error Resume Next
Application.ScreenUpdating = False
Sheets(1).Select
Sheets.Add
Sheets(1).Select
Sheets(1).Name = "目录"
Range("B1") = "目录"
For i% = 2 To Sheets.Count
ActiveWorkbook.Sheets(1).Select
Cells(i%, 1) = i% - 1
Cells(i%, 2).Select
ActiveSheet.Hyperlinks.Add Anchor:=Selection, Address:="", SubAddress:= _
"'" & Sheets(i%).Name & "'!A1", TextToDisplay:=Sheets(i%).Name
ActiveWorkbook.Sheets(i%).Select
For j% = 1 To ActiveSheet.Shapes.Count
If ActiveSheet.Shapes(j%).Name = "Re1" Then GoTo Er1
Next j%
ActiveSheet.Shapes.AddShape(msoShapeRectangle, 0#, 0#, 30#, 12#).Select
With Selection
.Name = "Re1"
.Characters.Text = "回目录"
.Characters.Font.Size = 10
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlCenter
.AutoSize = True
.AddIndent = False
.Font.ColorIndex = 2
.ShapeRange.Fill.ForeColor.SchemeColor = 12
.OnAction = "回目录"
End With
Er1: Cells(1, 1).Select
Next i%
Sheets(1).Select
Application.ScreenUpdating = True
End Sub
Sub 回目录()
Sheets(1).Select
End Sub
追问
厉害!!再请问一下这段代码是直接放在首表的第一个单元格里面吗?
回答
Alt+F11 把上述编码复制粘贴进去即可