Dzwebs.Net

撰写电脑技术杂文十余年

建立Excel目录及链接的VBA代码

Admin | 2015-11-29 6:10:33 | 被阅次数 | 5266

温馨提示!

如果未能解决您的问题,请点击搜索;登陆可复制文章,点击登陆

  建立Excel目录及链接的VBA代码。

  For i = 1 To Worksheets.Count
  If Worksheets(i).Name = "目录" Then
  Exit For
  End If
  Next
  If i > Worksheets.Count Then
  Sheets.Add
  ActiveSheet.Name = "目录"
  End If
  Sheets("目录").Move before:=Sheets(1)
  Sheets("目录").Select
  Range("B:C").Clear
  Range("B:B").NumberFormatLocal = "@"
  Worksheets(1).Cells(1, 2).Value = "编号"
  Worksheets(1).Cells(1, 3).Value = "目录"
  For i = 2 To Worksheets.Count
  Worksheets(1).Cells(i, 2).Value = i - 1
  With Worksheets(1)
           .Cells(i, 3).Value = Worksheets(i).Name
           .Hyperlinks.Add Anchor:=Cells(i, 3), Address:="", SubAddress:= _
            "'" & Worksheets(i).Name & "'!A1"
  End With
  Next


该杂文来自: Excel杂文

上一篇:多种公式计算excel非零个数

下一篇:Excel之票据8天后到期的时间设置

网站备案号:

网站备案号:滇ICP备11001339号-7

版权属性:

Copyright 2007-2021-forever Inc. all Rights Reserved.

联系方式:

Email:dzwebs@126.com QQ:83539231 访问统计