Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

excel

vba

cell

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

like image 535
user366121 Avatar asked Jun 07 '11 08:06

user366121


People also ask

How do you make a cell A1 active in Excel?

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.

How do you select a cell A1?

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.


1 Answers

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.

like image 82
Anders Lindahl Avatar answered Nov 16 '22 02:11

Anders Lindahl