ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Determine Selected Cells (https://www.excelbanter.com/excel-programming/273191-determine-selected-cells.html)

John Tripp[_2_]

Determine Selected Cells
 
In a VBA macro how do I determine the current selected
range. I am sure this is trivial, but I am having no luck
finding an example of code to do this.

Thanks for any help.

John

Bob Phillips[_5_]

Determine Selected Cells
 
John,

If you want to determine if a particular cell is selected, use something
like

If Not Intersect(Selection, Range("B99") Is Nothing Then
...

or

If Not Intersect(Selection, Range("B99:B100") Is Nothing Then
...

--

HTH

Bob Phillips

"Jim Rech" wrote in message
...
Perhaps you want something like this:

MsgBox Selection.Address

or

MsgBox ActiveWindow.RangeSelection.Address

The later for those rare occasions when the current selection is not a
range, such as when an object is selected.

--
Jim Rech
Excel MVP





John Tripp[_3_]

Determine Selected Cells - Got it Thanks!
 

-----Original Message-----
In a VBA macro how do I determine the current selected
range. I am sure this is trivial, but I am having no

luck
finding an example of code to do this.

Thanks for any help.

John
.



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

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