|
楼主 |
发表于 2018-6-19 13:56
|
显示全部楼层
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
'Option Explicit
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim rng As Range, theAddress$
Set rng = Union(Range("AD2"), Range("Y14:Y19"), Range("U6"), Range("AG9"))
If Not Intersect(Target, rng) Is Nothing Then
ThisWorkbook.BuiltinDocumentProperties("Comments") = ActiveCell.Address
GoTo The_Exit
End If
theAddress = ThisWorkbook.BuiltinDocumentProperties("Comments")
If theAddress = "" Then theAddress = ActiveCell.Address
If Target.Offset(-1).Address <> theAddress Then
ThisWorkbook.BuiltinDocumentProperties("Comments") = ActiveCell.Address
GoTo The_Exit
End If
ThisWorkbook.BuiltinDocumentProperties("Comments") = ActiveCell.Address
If Intersect(Range(theAddress), rng) Is Nothing Then GoTo The_Exit
Application.EnableEvents = False
Select Case theAddress
Case "$AD$2"
Range("Y14").Select
Case "$Y$19"
Range("U6").Select
Case "$AG$9"
Range("AD2").Select
ThisWorkbook.BuiltinDocumentProperties("Comments") = ActiveCell.Address
Case Else
Range(theAddress).Offset(1).Select
End Select
Application.EnableEvents = True
The_Exit:
Set rng = Nothing
End Sub
这个是我改的,加了U6,AG9两个单元格进去,但是运行到U6后,光标就无法跳转到AG9,恳请大神指点下,是哪里出问题了
|
|