写一段vba程序,在所有工作表中插入一个按钮
写一段vba程序,在所有工作表中插入一个名为“返回目录”的按钮,单击该按钮时转到本工作簿中的“目录”工作表,...
写一段vba程序,在所有工作表中插入一个名为“返回目录”的按钮,单击该按钮时转到本工作簿中的“目录”工作表,
展开
1个回答
展开全部
按Alt+F11,打开VBA编辑器,插入一个模块,把下面的代码贴进去,返回Excel按Alt+F8运行t3即可实现
Sub tt()
Sheets("目录").Select
End Sub
Sub t3()
Dim s As Worksheet
Set os = ActiveSheet
Application.ScreenUpdating = False
For Each s In ActiveWorkbook.Worksheets
If s.Name <> "目录" Then
s.Select
b = s.Buttons.Add(145.5, 25.5, 72, 72).Name
s.Shapes(b).OnAction = "tt"
s.Shapes(b).Select
Selection.Characters.Text = "返回目录"
Selection.Height = 20
Selection.Width = 50
End If
Next
os.Select
Application.ScreenUpdating = True
End Sub
Sub tt()
Sheets("目录").Select
End Sub
Sub t3()
Dim s As Worksheet
Set os = ActiveSheet
Application.ScreenUpdating = False
For Each s In ActiveWorkbook.Worksheets
If s.Name <> "目录" Then
s.Select
b = s.Buttons.Add(145.5, 25.5, 72, 72).Name
s.Shapes(b).OnAction = "tt"
s.Shapes(b).Select
Selection.Characters.Text = "返回目录"
Selection.Height = 20
Selection.Width = 50
End If
Next
os.Select
Application.ScreenUpdating = True
End Sub
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询