|
学习了,整理代码如下:
- Dim s$, t#
- Private Sub Workbook_SheetBeforeDoubleClick(ByVal Sh As Object, ByVal Target As Range, Cancel As Boolean)
- If ActiveCell = "" Then ActiveCell = t Else ActiveCell = s
- End Sub
- Private Sub Workbook_SheetBeforeRightClick(ByVal Sh As Object, ByVal Target As Range, Cancel As Boolean)
- If Target.Count = 1 Then Exit Sub Else Cancel = True
- With New DataObject '接管剪切板
- .SetText "=SUM(" & Selection.Address(0, 0) & ")"
- .PutInClipboard
- End With
- t = WorksheetFunction.Sum(Selection)
- s = "=SUM(" & Selection.Address(0, 0) & ")"
- Application.StatusBar = Format(t, "#,###.00 ") & s '设置状态栏信息
- End Sub
复制代码
发现鼠标右键被接管了。
这真是一个很有创意的程序。
|
|