回覆列表
  • 1 # 新聞提供者三號

    這個只能用vba來解決:

    取所有工作表名稱

    按下 alt+f11 ,選擇插入 模組,然後複製如下程式碼:

    Sub Excel各頁名()

    Dim XStr, YStr, ZStr

    XStr = " -"

    ZStr = ""

    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("A:B")

    .Clear

    Range("B:B")

    .NumberFormatLocal

    = "@"

    Worksheets(1).Cells(1,

    1)

    .Value

    = "序號"

    Worksheets(1).Cells(1,

    2)

    .Value

    = "名稱"

    For i = 2 To

    Worksheets.Count

    Worksheets(1).Cells(i,

    1)

    .Value

    = i - 1

    Worksheets(1).Cells(i,

    2)

    .Value

    = Worksheets(i)

    .Name

    For j = 1 To

    Len(Worksheets(i).Name)

    YStr = Mid(Worksheets(i).Name,

    j, 1)

    If InStr(XStr, YStr) <>

    0 Then

    ZStr = """

    Exit For

    End If

    Next

    ActiveSheet.Hyperlinks.Add

    Anchor:=Worksheets(1).Cells(i, 2), Address:="", SubAddress:=ZStr

    & Worksheets(i)

    .Name

    & ZStr & "!A1",

    TextToDisplay:=Worksheets(i)

    .Name

    Next

    Range("A:A")

    .HorizontalAlignment

    = xlCenter

    Rows("1:1")

    .HorizontalAlignment

    = xlCenter

    Cells.Select

    Selection.Columns.AutoFit

    Range("A1")

    .Select

    End Sub

    然後執行宏(可能會提示無法使用vba需要另外儲存支援格式之類)

  • 中秋節和大豐收的關聯?
  • 品牌戰略規劃怎麼做?