Convert cells reference to string reference??

  • Thread starter Thread starter Robert Crandal
  • Start date Start date
R

Robert Crandal

Does VBA have a function that will take rows and columns
arguments and return a string reference with letters and numbers??

For example, if I give the function row 1, column 1, then it should
return "A1". (ie. function(1,1) returns "A1")

Is there also an inverse of such a function, if it exists?

thankx
 
I'm not sure exactly where you are going with this; but, if I can try and
anticipate where you are headed, Excel's VBA has two different ways to
reference a cell, both of the following refer to A1...

Range("A1")
Cells(1, 1) or Cells(1, "A") whichever is more convenient.

So, if you are asking how to create "A1" from row 1, column 1 numbers so you
can create a reference to the cell using the Range property, you don't need
to... just use the Cells method of referencing instead. However, if you
really do need to form the text string...

Address = Cells(1, 1).Address(0, 0)

and to go the other way...

Row = Range("A1").Row
Column = Range("A1").Column
 
Hi

You can use Cells(r,c) in your statements instead of Range("A1"), or if you
really need the address:

MyAddress=Cells(1,1).Address


MyRow=Range("A1").Row
MyCol=Range("A1").Column

Regards,
Per
 
Back
Top