Excel小技巧
Public Sub ·�0�8�0�3�0�1�0�2�0�7�0�0�0�4()
Dim Msg, Style, Title, Help, Ctxt, Response, MyString
On Error GoTo ErrorHandler ' �0�7ò�0�7�0�9�0�7í�0�2ó�0�7�0�7�0�8í�0�6�0�0�0�4ò�0�3�0�5
Worksheets("�0�2�0�7�0�0�0�4").Activate
Worksheets("�0�2�0�7�0�0�0�4").Range("a1").Select
Exit Sub
ErrorHandler:
Msg = "�0�8�0�3 " & Worksheets.Parent.Name & " �0�0�0�4�0�1�0�3�0�7�0�4�0�2�0�7�0�0�0�4±í !" ' �0�9¨�0�6�0�2�0�4�0�3�0�3�0�4�0�3�0�5
Msg = Msg & vbLf & "�0�8�0�5·�0�9�0�7�0�7�0�5¨�0�2�0�7�0�0�0�4±í ?" ' �0�9¨�0�6�0�2�0�4�0�3�0�3�0�4�0�3�0�5
Style = vbYesNo + vbInformation + vbDefaultButton1 + vbApplicationModal ' �0�9¨�0�6�0�2°�0�7�0�3�0�6�0�3�0�5
Title = Worksheets.Parent.Name ' �0�9¨�0�6�0�2±ê�0�0�0�9�0�3�0�5
Response = MsgBox(Msg, Style, Title, Help, Ctxt)
If Response = vbYes Then ' �0�7�0�1�0�3§°�0�7�0�3�0�0�0�3°OK�0�3±�0�3�0�5
MyString = "Yes" ' �0�1ê�0�6�0�7�0�2�0�6�0�5�0�2×÷�0�3�0�5
�0�2�0�7�0�0�0�4
Else
MyString = "No" ' �0�1ê�0�6�0�7�0�2�0�6�0�5�0�2×÷�0�3�0�5
End If
End Sub
Public Sub �0�2�0�7�0�0�0�4() '�0�7ú�0�6�0�7�0�1¤×÷±í�0�2�0�7�0�0�0�4�0�5�0�1�0�7ú�0�6�0�7�0�8�0�2�0�2�0�7�0�0�0�4�0�1¤×÷±í�0�1�0�4�0�6�0�4�0�2�0�9�0�3°�0�2�0�7�0�0�0�4�0�3±�0�5�0�1�0�7ú�0�6�0�7�0�5°�0�5�0�5�0�3�0�6�0�6·�0�6�0�3�0�8�0�5·�0�9�0�6�0�5�0�7�0�4�0�1�0�1�0�1�0�4�0�8�0�2�0�1¤×÷±í
Dim ColStart As Long, RowStart As Long
Dim ws As Worksheet, xlSheet As Worksheet
Dim SheetName As String, SheetExists As Boolean
Dim Msg, Style, Title, Response, MyString
SheetName = "�0�2�0�7�0�0�0�4"
For Each ws In Worksheets
If ws.Name = SheetName Then
SheetExists = True
Exit For
End If
Next ws
If SheetExists Then
Msg = "�0�2�0�7�0�0�0�4�0�1¤×÷±í�0�6�0�5�0�7�0�3�0�8�0�3�0�5�0�1�0�8�0�5·�0�9�0�0�0�1�0�7ú�0�6�0�7�0�2�0�7�0�0�0�4�0�1¤×÷±í?" ' �0�9¨�0�6�0�2�0�4�0�3�0�3�0�4�0�3�0�5
Style = vbYesNo + vbInformation + vbDefaultButton1 + vbApplicationModal ' �0�9¨�0�6�0�2°�0�7�0�3�0�6�0�3�0�5
Title = Worksheets.Parent.Name ' �0�9¨�0�6�0�2±ê�0�0�0�9�0�3�0�5
Response = MsgBox(Msg, Style, Title)
If Response = vbYes Then ' �0�7�0�1�0�3§°�0�7�0�3�0�0�0�3°OK�0�3±�0�3�0�5
MyString = "Yes"
Set xlSheet = Worksheets(SheetName)
xlSheet.UsedRange.Clear
Else
MyString = "No"
Exit Sub
End If
Else
Set xlSheet = Worksheets.Add(Before:=Worksheets(1), Count:=1, Type:=xlWorksheet)
xlSheet.Name = SheetName
End If
If SheetExists Then
Else
End If
xlSheet.Move Before:=Worksheets(1)
xlSheet.Activate
xlSheet.Cells(1, 1).Value = "�0�2�0�7�0�0�0�4"
RowStart = 2
ColStart = 1
For Each ws In Worksheets
If ws.Name <> SheetName Then
With xlSheet
.Hyperlinks.Add Anchor:=.Cells(RowStart, ColStart), _
Address:="", _
SubAddress:="'" & ws.Name & "'" & "!A1", _
ScreenTip:=ws.Name, _
TextToDisplay:=ws.Name
RowStart = RowStart + 1
End With
End If
Next ws
End Sub
使用超链接函数。