首页 > 解决方案 > 根据选择的超链接更新单元格值

问题描述

我正在尝试在下面的链接中调整代码。

我需要它,在我的第一张表中,当在 F 列中单击超链接(链接到第二张表“定价”)时,A 列中相应单元格的值将打印在定价表的 C 列中。

例子:

https://www.techonthenet.com/excel/hyperlinks/update_cell2013.php

该代码基于一个平面值,我需要它在每一行上动态工作:

If Sh.Name = "First Sheet" Then
    If GSourceCell = "F6" Then
        Sheets("Pricing").Range("C6").Value = Sheets("First Sheet").Range("A6")

标签: excelvba

解决方案


我希望这有帮助:

If Sh.Name = "First Sheet" Then
If GSourceCell = "F" & ActiveCell.Row Then
Sheets("Pricing").Range("C & ActiveCell.Row").Value = Sheets("First Sheet").Range("A" & ActiveCell.Row)

推荐阅读