将单元格超链接到同一工作表中的另一个单元格 [英] Hyperlinking a cell to another cell in the same worksheet

查看:411
本文介绍了将单元格超链接到同一工作表中的另一个单元格的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想如果在A列下单击x,绿色矩形将移至最右边的1:在A1处单击第一个x会到达(1,P3),A2->(2,P2),A3 ->(3,P2),A4->(4,P3).

I'd like if x is clicked under column A, the green rectangle moves to the 1 to the farthest right: Clicking first x at A1 arrives at (1, P3), A2 -> (2, P2), A3 -> (3, P2), A4 -> (4, P3).

我编写该代码的目的是将A1,A2,A3和A4超链接到相应的PCell.如何获取P列下最右边的1?

I've written the code with an intention to hyperlink A1, A2, A3, and A4 to corresponding PCell. How do I fetch the 1's on the farthest right under the P columns?

还有另一种方法吗?

Sub GoToPCell()

Dim i As Integer, PCell As String

PCell =


For i = 1 To 4

ActiveSheet.Hyperlinks.Add Cells(i, 1), Address:="", SubAddress:="'" & Sheet1.Name & "'!PCell"


Next i

End Sub

推荐答案

BigBen先生评论了解决您的问题的主要部分.我刚刚发布了完整的子内容,如下所示.试试...

As Mr. BigBen comment the main part to solve your problem. I have just post full sub as below. Try...

Sub GoToPCell()
Dim i As Integer, PCell As String
    For i = 1 To 4
        PCell = Cells(i, Columns.Count).End(xlToLeft).Address
        ActiveSheet.Hyperlinks.Add Cells(i, 1), Address:="", SubAddress:="'" & Sheet1.Name & "'!" & PCell
    Next i
End Sub

这篇关于将单元格超链接到同一工作表中的另一个单元格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆