ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   how to find if multiple chart objects are selected? (https://www.excelbanter.com/excel-programming/356883-how-find-if-multiple-chart-objects-selected.html)

Chimanrao

how to find if multiple chart objects are selected?
 
hi
how do i find if multiple chart objects are selected by the user using
the ctrl + click mechanism?
chiman


Martin

how to find if multiple chart objects are selected?
 
TypeName(Selection) returns "DrawingObjects" if more than one chart is
selected.


"Chimanrao" wrote:

hi
how do i find if multiple chart objects are selected by the user using
the ctrl + click mechanism?
chiman



Peter T

how to find if multiple chart objects are selected?
 
Sub test()
Dim ob As Object, s As String

If TypeName(Selection) = "DrawingObjects" Then
For Each ob In Selection
If TypeName(ob) = "ChartObject" Then
cnt = cnt + 1
End If
Next
s = cnt & " / " & Selection.Count & _
" selected objects are ChartObjects"
Else
s = TypeName(Selection)
End If

MsgBox s

End Sub

Strangely, when I first tested in Excel 97 if multiple chartobjects and only
chartobjects were selected TypeName(Selection) returned "ChartObject". But
later in testing it returned "DrawingObjects" same as later versions. Odd!

Regards,
Peter T

"Chimanrao" wrote in message
oups.com...
hi
how do i find if multiple chart objects are selected by the user using
the ctrl + click mechanism?
chiman





All times are GMT +1. The time now is 09:55 AM.

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