Excel VBA中需要相对单元格地址 [英] Relative Cell Address needed in Excel VBA
本文介绍了Excel VBA中需要相对单元格地址的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要一个相对单元格地址。即A2不是$ A $ 2
I need a relative cell address. i.e. "A2" not "$A$2"
当我使用 myAddress = Worksheets(Sheet1)时,单元格(1,2)。地址
,
myAddress返回$ B $ 2。我实际上需要相对价值 B2
。
为什么,你问?我知道你会问...因为我想要使用那个 B2
单元格地址填充到下面的所有单元格的公式。而且我不希望每个后续单元格引用 B2
,而是 C2
然后 D2
等等。
Why, you ask? I knew you would ask... Because I want to then fill down the formula using that B2
cell address to all of the cells below it. And I don't want each subsequent cell to refer to B2
, but C2
then D2
and so on.
推荐答案
myAddress = Worksheets("Sheet1").Cells(1, 2).Address(False, False)
这篇关于Excel VBA中需要相对单元格地址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文