Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
SMH SMH is offline
external usenet poster
 
Posts: 29
Default how to get a macro to store address of a cell

I have a macro that selects two cells say c3 and c5 at different times in the
same run.
I need to store the cell addresses of C3 and C5 so that the macro can use
them to create a print range by offsetting from the two addresses of c3 and
c5.

The problem is how can I store the addresses of the two cells when the macro
selects them.
If value (say in cell c3) = 3 and the macro selects this cell then I want
the address of the selected cell, here being C3, to be stored for use later .

would appreciate the code that has to be included to do this

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 318
Default how to get a macro to store address of a cell

If C3 and C5 are fixed, you already know their addresses so why would you
want to save them. Nevertheless, here is the code

Sub Macro1
'Declare two string variables to store the addresses
Dim sAddress1$,sAddress2$

'When C3 has been selected
sAddress1 = Selection.Address

'When C3 has been selected
sAddress2 = Selection.Address

End Sub

Hope this is what you were looking for.
Alok Joshi

"SMH" wrote:

I have a macro that selects two cells say c3 and c5 at different times in the
same run.
I need to store the cell addresses of C3 and C5 so that the macro can use
them to create a print range by offsetting from the two addresses of c3 and
c5.

The problem is how can I store the addresses of the two cells when the macro
selects them.
If value (say in cell c3) = 3 and the macro selects this cell then I want
the address of the selected cell, here being C3, to be stored for use later .

would appreciate the code that has to be included to do this

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 store through a cell that contains a cell address in it? Big Gray Cat Excel Discussion (Misc queries) 2 September 4th 08 09:18 PM
store address in a cell and use it in formula gbalamani Excel Discussion (Misc queries) 1 April 17th 07 10:36 AM
Data Validation: Store cell address instead of value in the cell? WillW Excel Discussion (Misc queries) 1 January 31st 07 02:22 AM
Help Pls re macro cell address Hugh Jago Excel Discussion (Misc queries) 2 January 5th 05 09:01 PM
store cell contents and cell address for comparsion & suming Jim Whelchel Excel Programming 1 November 24th 04 04:03 PM


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

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"