【发布时间】:2020-05-05 17:27:32
【问题描述】:
下面的宏使用超链接函数更新 A 列。
在我的查询/数据源上单击数据刷新后如何运行它?
我尝试在我的工作表上写一个更改条件。
Sub InsertHyperlinkFormulaInCell()
currentRow = 2
While Cells(currentRow, 2) <> "" 'check whether Column B is empty, stop if it is
ActiveWorkbook.Worksheets("Query").Cells(currentRow, 1) = "=HYPERLINK(CONCAT(X" & currentRow & ",B" &
currentRow & "),W" & currentRow & ")"
currentRow = currentRow + 1
Wend
End Sub
【问题讨论】:
-
旁注:通常更好的做法是find the last row 并一步将公式写入整个范围,而不是循环。