using marked range on spreadsheet in a macro


Posted by Eli Weiss on February 26, 2001 5:39 AM

Hi fellows,

In order to do any action on a range of cells in Excel macros (like painting the range area in any color), one has to specify this range directly [Range(“A1:C5”)] or indirectly, like [ActiveCell.CurrenRegion], or by using InputBox and so on.

My question is how can one mark a range area with the mouse directly on the spreadsheet before or during the macro execution, so that it will be used within the macro as a defined range when it is needed.

Eli Weiss

Posted by JAF on February 26, 2001 6:39 AM

Eli

I think this will give you what you need...

http://j-walk.com/ss/excel/tips/tip81.htm

JAF

Posted by Eli Weiss on February 26, 2001 12:33 PM

JAF

Thank you for your quick response to my question,
though I am afraid that I did not make myself clear enough.

I am familiar with your solution of using inputbox to enter ranges,
but its disadvantage is that you must know the range block in advance.

I am looking for a solution in which at a certain point the macro will stop
and show the spreadsheet. Then by using the mouse one will be able to mark any range of cells
on the sheet by pointing and dragging it over a block of cells.
The macro will then use this range to execute its task.

Looking forward for a solution

Eli

Posted by Celia on March 06, 2001 4:10 PM

>>> You do not need to know in advance.

>>> This is exactly what you can do with the solution already provided.



Posted by Eli Weiss on March 06, 2001 10:23 PM

Thank you Celia
You ara right of course
The "Type:=8" does the work
I wrote back to JAF and told him that his solution
was just what I needed
Thank you again
Eli