Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default 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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 620
Default 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




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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
.

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
Multiple cells or columns are selected instead of selected cell or Mikey Excel Discussion (Misc queries) 1 April 29th 09 09:48 PM
determine the name of the selected pivot table Tim879 Excel Discussion (Misc queries) 1 September 23rd 07 05:02 PM
Cells are selected but aren't displayed as selected Nifty Excel Discussion (Misc queries) 2 September 17th 06 07:22 PM
Cells are selected but aren't displayed as selected Nifty Excel Worksheet Functions 0 September 17th 06 11:34 AM
A validated List which link to selected cells according to what is selected on the list WL Excel Worksheet Functions 1 June 5th 06 08:52 PM


All times are GMT +1. The time now is 03:13 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"