ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Need to identify object selected. (https://www.excelbanter.com/excel-programming/288234-need-identify-object-selected.html)

Neil Bhandar[_2_]

Need to identify object selected.
 
How do I verify if I have selected an object other than a
cell or a range of cells?

Can any one pls help.

Thanks,
-Neil

pikus

Need to identify object selected.
 
If it is only one or if it many cells, the code is the same:

var1 = TypeName(Selection)
If var1 < "Range" Then
DoStuff
Else
DontDoStuff
End If

- Piku

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


David

Need to identify object selected.
 
Not sure if this will work or help. NameType(activeobject)
If you can stop the code where you want this might help
in the immediate window.

-----Original Message-----
How do I verify if I have selected an object other than

a
cell or a range of cells?

Can any one pls help.

Thanks,
-Neil
.


Rob van Gelder[_4_]

Need to identify object selected.
 
Neil,

Sub testit()
If Not TypeOf Selection Is Range Then MsgBox "Selection is not a range"
End Sub


Rob

"Neil Bhandar" wrote in message
...
How do I verify if I have selected an object other than a
cell or a range of cells?

Can any one pls help.

Thanks,
-Neil





All times are GMT +1. The time now is 12:32 AM.

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