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
Active cell overview When you first start Excel the active cell is the first cell, which is always A1. You can move the cell pointer by pressing the arrow keys or Enter on your keyboard, or you can click any cell using your computer mouse. If you're using the keyboard, you can also press the F2 to edit the active cell.
Jump to cell A1 by shortcuts If you want to quickly jump to cell A1 from anywhere of the sheet, you just need to hold Ctrl key, and press Home, then the cursor jumps to the cell A1 at once.
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
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With