Converting RIC1 code to letter Column/Numeric Row

R

RidgeView

There must be an easy way to make cell "numeric row"/"numeric column" (R1C1
notation) to "Alpha Row"/Numeric Column" (e.g. "B3") format. There are macro
statements that require the latter and it would be nice to use a variable for
those cell locations especially when the active cell is required.
Thanks.....
 
S

Shane Devenshire

Hi,

You can use A1 notation instead of R1C1 notation anytime you want. So I'm
not sure what you want - please give us an example of what you want.
 
R

RidgeView

Hi...Thanks for responding....
An example that comes to mind is "Range("A1").Select". If I try to change
it to "Range(Cells(1, 1)).Select", Excel will immediately go into a "Debug"
state. I have a macro now that could use a variable such as
"Range(Cells(RowNo,ColNo)).Select" as well as the "Current Active Cell". I
fairly new using VBA macros but a former programmer.
Thanks again...
 
D

Dave Peterson

use
Range("a1").select
or
cells(1,1).select
or
cells(rowno,colno).select

But it's very unlikely that you have to select the range to work with it.

Instead of:
cells(rowno,colno).select
selection.numberformat = "@"
selection.value = "Hi"

you could use
cells(rowno,colno).numberformat = "@"
cells(rowno,colno).value = "Hi"

or
with cells(rowno,colno)
.numberformat = "@"
.value = "Hi"
end with
(to save some typing and make it easier to read/debug.)
 
S

Shane Devenshire

Hi,

As Dave has implied we use

Cells(1,1) to indicate A1. You do not need to modifiy it with the Range
method.

Sometimes you might choose to do this

Range(Cells(1,1),Cells(2,2)).Select

If there was any reason, and there is none, you could use

Range(Cells(1,1).Address).Select

The active cell is call the ActiveCell and can be used like this

ActiveCell.Offset(1,0).Select

This code moves the cursor down on cell in the same column. Or

ActiveCell.Select

This code collapses the selected range down to the active cell.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top