开发者

Convert cells(1,1) into "A1" and vice versa

开发者 https://www.devze.com 2023-03-10 18:10 出处:网络
I am working on an worksheet generator in Excel 2007. I have a certain layout I have to follow and I often have to format cells based on input. Since the generator is dynamic I have to calculate all k

I am working on an worksheet generator in Excel 2007. I have a certain layout I have to follow and I often have to format cells based on input. Since the generator is dynamic I have to calculate all kinds of ranges, merge cells, etc.

How can I convert values l开发者_StackOverflow中文版ike this?

Cells(1,1) into A1 and vice versa


The Address property of a cell can get this for you:

MsgBox Cells(1, 1).Address(RowAbsolute:=False, ColumnAbsolute:=False)

returns A1.

The other way around can be done with the Row and Column property of Range:

MsgBox Range("A1").Row & ", " & Range("A1").Column

returns 1,1.

0

精彩评论

暂无评论...
验证码 换一张
取 消