Chart unselect

User avatar
ErikJan
BronzeLounger
Posts: 1235
Joined: 03 Feb 2010, 19:59
Location: Terneuzen, the Netherlands

Chart unselect

Post by ErikJan »

If I am on a chart-sheet and I select an (any) element and then I move away from that sheet, I'd like all selections to be undone (so that the next time I select the chart-sheet, nothing is selected).
Without Sendkeys, how do I do that? I tried some stuff but I can't seem to fix this yet...

User avatar
HansV
Administrator
Posts: 78446
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Chart unselect

Post by HansV »

I found this:

Code: Select all

    With ActiveSheet ' Or Sheets("MyChart")
        .Protect
        .Unprotect
    End With
Best wishes,
Hans

User avatar
ErikJan
BronzeLounger
Posts: 1235
Joined: 03 Feb 2010, 19:59
Location: Terneuzen, the Netherlands

Re: Chart unselect

Post by ErikJan »

Thanks, looks like it's the "Protect" that un-selects

User avatar
ErikJan
BronzeLounger
Posts: 1235
Joined: 03 Feb 2010, 19:59
Location: Terneuzen, the Netherlands

Re: Chart unselect

Post by ErikJan »

Which brings my next problem... I'd like the chart to be protected but still selected ;-)

Somehow I can have a protectionmode = true and still have the chart selected if i do things manually (Excel Ribbon says "Unprotect Sheet" so it is protected). But I can't make that happen in VBA yet

User avatar
HansV
Administrator
Posts: 78446
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Chart unselect

Post by HansV »

Do you want the ChartArea to be selected, or the PlotArea, or ...?
Best wishes,
Hans

User avatar
ErikJan
BronzeLounger
Posts: 1235
Joined: 03 Feb 2010, 19:59
Location: Terneuzen, the Netherlands

Re: Chart unselect

Post by ErikJan »

Doesn't matter really I think...

I'm working on a "chart highlighter". If my mouse moves over a chart series it will change color.
The event only triggers if the chart is selected first. At the same time, I don't want the user to make any changes...

Of course I'm only refining some code I found already; I'll share here when things work the way I want them to work...

User avatar
HansV
Administrator
Posts: 78446
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Chart unselect

Post by HansV »

I don't think it's possible to select anything on a protected chart sheet using VBA.
Best wishes,
Hans

User avatar
ErikJan
BronzeLounger
Posts: 1235
Joined: 03 Feb 2010, 19:59
Location: Terneuzen, the Netherlands

Re: Chart unselect

Post by ErikJan »

I don't need to select, just hover with my mouse (but the chart should be selected)

User avatar
HansV
Administrator
Posts: 78446
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Chart unselect

Post by HansV »

No idea... :shrug:
Best wishes,
Hans