PC Review


Reply
Thread Tools Rate Thread

Convert cells reference to string reference??

 
 
Robert Crandal
Guest
Posts: n/a
 
      1st Dec 2009
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

 
Reply With Quote
 
 
 
 
Rick Rothstein
Guest
Posts: n/a
 
      1st Dec 2009
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

--
Rick (MVP - Excel)


"Robert Crandal" <(E-Mail Removed)> wrote in message
news:_t3Rm.9677$(E-Mail Removed)...
> 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
>


 
Reply With Quote
 
Per Jessen
Guest
Posts: n/a
 
      1st Dec 2009
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


"Robert Crandal" <(E-Mail Removed)> skrev i meddelelsen
news:_t3Rm.9677$(E-Mail Removed)...
> 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
>


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Range of cells: Convert relative reference into absolute Igor Microsoft Excel Misc 5 30th Sep 2008 01:16 AM
how do I convert text string into a cell reference =?Utf-8?B?RGF2ZSBEYXZpcw==?= Microsoft Excel Misc 3 10th Jun 2008 09:38 PM
Convert String to Function Reference ViestaWu Microsoft Excel Worksheet Functions 1 27th Nov 2007 06:58 AM
Convert text string in format of cell reference to a cell reference =?Utf-8?B?RnJhbms=?= Microsoft Excel Misc 1 16th Dec 2003 08:52 AM
convert text string to cell reference =?Utf-8?B?QW5kcmV3?= Microsoft Excel Misc 1 15th Dec 2003 06:44 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 07:40 AM.