|
Sub 新建工作表()
Dim d As Object
Set d = CreateObject("scripting.dictionary")
For Each sh In Sheets
If sh.Index > 2 Then
d(sh.Name) = ""
End If
Next sh
With Sheets("目录")
ar = .[a1].CurrentRegion
End With
For i = 2 To UBound(ar)
If Trim(ar(i, 1)) <> "" Then
mc = Trim(ar(i, 1))
If Not d.exists(mc) Then
Sheets("模板").Copy after:=Sheets(Sheets.Count)
With ActiveSheet
.Name = mc
.[b1] = mc
Sheets("目录").Hyperlinks.Add Anchor:=Sheets("目录").Range("a" & i), Address:="", SubAddress:=mc & "!" & .[b1].Address
.Hyperlinks.Add Anchor:=.Range("b1"), Address:="", SubAddress:="目录!" & Sheets("目录").Range("a" & i).Address
End With
End If
End If
Next i
MsgBox "ok!"
End Sub
|
|