Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 309
Default Convert cells reference to string reference??

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

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,934
Default Convert cells reference to string reference??

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" wrote in message
...
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


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,533
Default Convert cells reference to string reference??

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" skrev i meddelelsen
...
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
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
how do I convert text string into a cell reference Dave Davis Excel Discussion (Misc queries) 4 May 18th 23 11:48 AM
Range of cells: Convert relative reference into absolute Igor Excel Discussion (Misc queries) 5 September 30th 08 01:16 AM
Convert String to Function Reference ViestaWu Excel Worksheet Functions 1 November 27th 07 06:58 AM
Formulas that reference cells that reference another cell Andrea Excel Discussion (Misc queries) 7 October 19th 06 08:14 AM
How to get reference to a range as string? [email protected] Excel Programming 3 January 14th 05 09:09 PM


All times are GMT +1. The time now is 08:02 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"