Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default VBA returning a cell address

I am trying to write VBA code to return the cell address on one
worksheet within a workbook to another worksheet. The result will be
in the simple formula, for example "='Sheet1'!B3" and this formula
will be on Sheet 2.

I have a macro that is giving the cell on Sheet1 a range name,
"FirstCell" in this case, because the cell I want is a moving target.
I have another piece of macro code which is the following,
Range("D5").Formula = "='Sheet1!" & Range("FirstCell").Address. This
is doing a great job of putting the formula ='Sheet1'!$B$3 on Sheet 2
in cell D5. The problem is that it is an absolute reference and I
want a relative reference. How can I change this result so I will
have the formula ='Sheet1'!B3.

Thanks, Ken
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 45
Default VBA returning a cell address

Hi Ken:

Range("FirstCell").Address(False,False)

Regards,

Vasant.

wrote in message
om...
I am trying to write VBA code to return the cell address on one
worksheet within a workbook to another worksheet. The result will be
in the simple formula, for example "='Sheet1'!B3" and this formula
will be on Sheet 2.

I have a macro that is giving the cell on Sheet1 a range name,
"FirstCell" in this case, because the cell I want is a moving target.
I have another piece of macro code which is the following,
Range("D5").Formula = "='Sheet1!" & Range("FirstCell").Address. This
is doing a great job of putting the formula ='Sheet1'!$B$3 on Sheet 2
in cell D5. The problem is that it is an absolute reference and I
want a relative reference. How can I change this result so I will
have the formula ='Sheet1'!B3.

Thanks, Ken



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
Struggling with returning a cell address Oddjob Excel Discussion (Misc queries) 0 October 27th 09 09:48 PM
Returning a cell address in a msgbox, by selection via inputbox Ty FARAZ QURESHI Excel Discussion (Misc queries) 3 April 8th 09 12:57 PM
Returning an address from an array wienmichael Excel Discussion (Misc queries) 6 May 2nd 07 02:53 AM
returning the address of a value Excel Enthusiastic Excel Discussion (Misc queries) 1 April 11th 07 05:40 PM
=(INDIRECT(ADDRESS(ROW(),#))) with SUMPRODUCT returning #VALUE! Brian Williams Excel Worksheet Functions 7 March 30th 07 02:28 PM


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

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

About Us

"It's about Microsoft Excel"