|
受教以下部分:
Sub 建立工作表目录()
Application.Calculation = xlCalculationManual '手动重算
'Sheets(1).Name = "目录"
For i = 2 To Sheets.Count
Cells(i, 1) = Sheets(i).Name
'Sheets(1).Hyperlinks.Add Cells(i, 1), "#" & Sheets(i).Name & "!A1" '添加超链接
Next
Application.Calculation = xlCalculationAutomatic '自动重算
End Sub
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
On Error Resume Next '忽略错误继续执行VBA代码,避免出现错误消息
If Not Application.Intersect(Target, Range("A2:A1000")) Is Nothing Then
Sheets(ActiveCell & "").Select
End If
If Not Application.Intersect(Target, Range("K2:K100")) Is Nothing Then
a = ActiveCell.Value '当前单元内容
mOpen = Shell("Explorer.exe " & a, vbNormalFocus) '打开目录
End If
End Sub
拿走了,谢谢 |
|