|
本帖最后由 gbgbxgb 于 2020-2-19 19:14 编辑
通过“双击”,双击哪里?莫名其妙!
“彼表”又是什么表?sheet1表?让我们去猜?
参考下列代码:
- Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
- Dim theRow&, theCommentRow&, theCommentColumn&, theStr$
- '
- With Me
- If Target.Address = .Cells(.Rows.Count, 1).End(xlUp).Address Then
- Cancel = True
- With Target
- theRow = .Row
- theCommentRow = .Comment.Text
- theCommentColumn = .Offset(, 1).Comment.Text
- End With
- '
- If theCommentRow > 0 And theCommentColumn > 0 Then
- Do
- If .Cells(theRow, 1).Interior.ColorIndex <> 3 Then
- If theRow > 1 Then
- theRow = theRow - 1
- Else
- theRow = 0
- Exit Do
- End If
- Else
- Exit Do
- End If
- Loop
- '
- If theRow > 0 Then
- theStr = .Cells(theRow, 1)
- On Error Resume Next
- Sheets(theStr).Select
- If Err = 0 Then
- On Error GoTo 0
- Sheets(theStr).Cells(theCommentRow, theCommentColumn).Select ''根据点击的格中的批注中的行号链接到源格
- Else
- On Error GoTo 0
- End If
- End If
- End If
- End If
- End With
- End Sub
复制代码
|
评分
-
1
查看全部评分
-
|