ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Selection type (https://www.excelbanter.com/excel-programming/347050-selection-type.html)

Martin Stender

Selection type
 
Hi all,

I have done a lot of VBA programming in PowerPoint, but I'm new to
Excel.

Now, want to manipulate charts, but I cannot figure out how to detect
if on or more charts on the active sheet are selected or not.

How do you discern between 'selection types' in Excel?

Thanks in advance! :-)

Martin


Chip Pearson

Selection type
 
Martin,

Use the TypeOf operator. E.g.,

If TypeOf Selection Is Excel.ChartArea Then
Debug.Print "Chart selected"
End If


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com




"Martin Stender" wrote in message
oups.com...
Hi all,

I have done a lot of VBA programming in PowerPoint, but I'm new
to
Excel.

Now, want to manipulate charts, but I cannot figure out how to
detect
if on or more charts on the active sheet are selected or not.

How do you discern between 'selection types' in Excel?

Thanks in advance! :-)

Martin




Vic Eldridge[_3_]

Selection type
 
Hi Martin,

The following macro should give you some more ideas.
It is worth noting that with regards to charts, clicking on a commandbutton
to run such code can change which part of the chart is selected.


Regards,
Vic Eldridge


Sub WhatIsSelected()

MsgBox "TypeName = " & TypeName(Selection)

If TypeName(Selection) = "DrawingObjects" Then
Dim DrwObj As Object
For Each DrwObj In Selection
MsgBox TypeName(DrwObj)
Next
End If

End Sub




"Martin Stender" wrote:

Hi all,

I have done a lot of VBA programming in PowerPoint, but I'm new to
Excel.

Now, want to manipulate charts, but I cannot figure out how to detect
if on or more charts on the active sheet are selected or not.

How do you discern between 'selection types' in Excel?

Thanks in advance! :-)

Martin




All times are GMT +1. The time now is 07:54 PM.

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