ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Range from highlighted area (https://www.excelbanter.com/excel-programming/290764-range-highlighted-area.html)

noyb[_2_]

Range from highlighted area
 
I want to work with a range; the location, size etc., is defined by the
user highlighting an area on the worksheet then starting up a macro. How
do I use the currently highlighted area as a range?
Thanks


JE McGimpsey

Range from highlighted area
 
Use the Selection object. E.g.:

Selection.Interior.ColorIndex = 6

In article , noyb
wrote:

I want to work with a range; the location, size etc., is defined by the
user highlighting an area on the worksheet then starting up a macro. How
do I use the currently highlighted area as a range?
Thanks


Bob Phillips[_6_]

Range from highlighted area
 
This highlighted area is called the selected range, and can be accessed in
VBA with the Selection object.

Selection.Address

returns the address of that selection,

etc.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"noyb" wrote in message
...
I want to work with a range; the location, size etc., is defined by the
user highlighting an area on the worksheet then starting up a macro. How
do I use the currently highlighted area as a range?
Thanks




Tom Ogilvy

Range from highlighted area
 
Selection

as in

msgbox Selection.Address

--
Regards,
Tom Ogilvy

"noyb" wrote in message
...
I want to work with a range; the location, size etc., is defined by the
user highlighting an area on the worksheet then starting up a macro. How
do I use the currently highlighted area as a range?
Thanks





All times are GMT +1. The time now is 10:06 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com