Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Understanding Selection "Type"

How can one determined what "type" of selection has been made? Since a
selection could be a range, a shape, a chartobject, etc., how do you
know which type and how can you determine which particular instance of
that type?

Thanks


---
Message posted from http://www.ExcelForum.com/

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,236
Default Understanding Selection "Type"


TypeName is what you're after:

Sub test()
MsgBox TypeName(Selection)
End Sub

Another way is:
If TypeOf Selection Is Rectangle Then MsgBox "Selection is a Rectangle"


--
Rob van Gelder - http://www.vangelder.co.nz/excel


"MWE " wrote in message
...
How can one determined what "type" of selection has been made? Since a
selection could be a range, a shape, a chartobject, etc., how do you
know which type and how can you determine which particular instance of
that type?

Thanks


---
Message posted from http://www.ExcelForum.com/



  #3   Report Post  
Posted to microsoft.public.excel.programming
MWE MWE is offline
external usenet poster
 
Posts: 20
Default Understanding Selection "Type"

Ron: Your reply was most helpful. However, I still can
not quite do what I want. Assume a worksheet on which
there are various objects, e.g., charts, pictures,
textboxes, rectangles, etc. I wish to be able to select
any of these objects and know its "type" (you already
showed me how to do that) and be able to work with that
specific object. For a range or chart, working with the
selected object is understood (active cell, activechart,
etc). But for a item that the worksheet includes in its
collection of shapes, I do not know how to identify the
specific instance.

Thanks
-----Original Message-----

TypeName is what you're after:

Sub test()
MsgBox TypeName(Selection)
End Sub

Another way is:
If TypeOf Selection Is Rectangle Then

MsgBox "Selection is a Rectangle"


--
Rob van Gelder - http://www.vangelder.co.nz/excel


"MWE " wrote in

message
...
How can one determined what "type" of selection has

been made? Since a
selection could be a range, a shape, a chartobject,

etc., how do you
know which type and how can you determine which

particular instance of
that type?

Thanks


---
Message posted from http://www.ExcelForum.com/



.

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
"Type mismatch" when I try to fill an Array variable with "+" [email protected] Excel Discussion (Misc queries) 1 April 17th 07 01:28 PM
how do I type "itis" without Excel putting a space "it is"? Max Excel Worksheet Functions 4 March 18th 07 10:22 PM
When I type "13" the spreadsheet shows "14." Possibilities? Absolutely Stumped Excel Discussion (Misc queries) 7 May 30th 06 10:19 PM
Where is the toolbar with the "bold type", "font type", options fwccbcc New Users to Excel 2 May 3rd 06 09:11 PM


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