Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 06-24-2023, 10:53 PM
soroush.kalantari soroush.kalantari is offline How to write a code which select a chart when clicking on it? Windows 10 How to write a code which select a chart when clicking on it? Office 2016
Competent Performer
How to write a code which select a chart when clicking on it?
 
Join Date: Jun 2021
Posts: 115
soroush.kalantari is on a distinguished road
Default How to write a code which select a chart when clicking on it?

How to write a code which select a chart when clicking on it?
I have written following macro to display a chart in another worksheet (customizing “excel moving chart feature”) when clicking on it. (I want to assign this macro to all my charts). My problem is that I don’t Know how to select (activate) the chart I want to have it displayed in another worksheet. (see the attachment.)
Can you guides me on this issue?

Sub enlargchart()
On Error Resume Next



Application.DisplayAlerts = False
ActiveWorkbook.Charts.Delete
ActiveChart.ChartArea.Copy
range("A1").Select

ActiveSheet.Paste

ActiveChart.Location Where:=xlLocationAsNewSheet

Application.DisplayAlerts = True




End Sub
Attached Files
File Type: xlsm enlargecharts.xlsm (41.9 KB, 4 views)
Reply With Quote
  #2  
Old 09-08-2023, 08:12 PM
soroush.kalantari soroush.kalantari is offline How to write a code which select a chart when clicking on it? Windows 10 How to write a code which select a chart when clicking on it? Office 2016
Competent Performer
How to write a code which select a chart when clicking on it?
 
Join Date: Jun 2021
Posts: 115
soroush.kalantari is on a distinguished road
Default

I have found the answer of this question: In these situations, using “Application.Caller” ,Can do the job. For example, this line of code can activates the clicked chart: ActiveSheet.ChartObjects(Application.Caller).Activ ate
Reply With Quote
Reply

Tags
activate, chart



Similar Threads
Thread Thread Starter Forum Replies Last Post
VBA Newbie (Trying to write a code to copy and paste info from one sheet to another) Forum2000s Excel Programming 2 05-07-2017 04:51 AM
How to write a code which select a chart when clicking on it? Can I select the entire second or third level in an org. chart? blockie Word 1 08-25-2014 11:19 PM
Way to select a range using the mouse on a chart? omahadivision Excel Programming 6 12-29-2012 09:21 AM
VBA code for count w and write into another column in excel tomlam Excel Programming 2 10-09-2012 03:56 AM
How to write in Word from Select query lakhan.p Word 0 03-27-2009 07:25 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 09:49 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft