eulb悠忘
?如何按照目录中的姓名批量生成对应名称的sheet? 并实现批量超链接?
第1个问题:
sub test()
For m = 2 To Cells(Rows.Count, 1).End(3).Row
bname = Cells(m, 1).Value
Sheets.Add
ActiveSheet.Name = bname
Range("A1").Select
Next m
end sub
第2个问题:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim R As Integer
If Target.Count = 1 Then
If Target.Column = 1 Then
R = [A65500].End(xlUp).Row
On Error Resume Next
If Target.Row > 2 And Target.Row <= R Then
Sheets(Target.Value).Select
End If
End If
End If
End Sub
代码有问题么
友交好
Sub 建立目录()
Dim I As Integer
For I = 1 To Sheets.Count
If Sheets(I).Name = "工作表目录" Then GoTo mulu
Next
Worksheets.Add Worksheets(1)
ActiveSheet.Name = "工作表目录"
mulu:
Worksheets("工作表目录").Range("a:b").Clear
For I = 2 To Worksheets.Count
Worksheets("工作表目录").Cells(I - 1, 1).Value = I - 1
Worksheets("工作表目录").Hyperlinks.Add anchor:=Worksheets("工作表目录").Cells(I - 1, 2), Address:="", SubAddress:="'" & Worksheets(I).Name & "'!A1", TextToDisplay:=Worksheets(I).Name, ScreenTip:="单击打开:" & Worksheets(I).Name
Next
End Sub
?忘悠blue 不知道你这个哪时出错,给我写了一个,运行正确了
你结合使用