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

ExcelVbaCell

Excel Problem Overview


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 like this?

Cells(1,1) into A1 and vice versa

Excel Solutions


Solution 1 - Excel

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.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
Questionuser366121View Question on Stackoverflow
Solution 1 - ExcelAnders LindahlView Answer on Stackoverflow