June 26, 2016
Hello everyone My name is A.Maurizio
My problem is this: On Sheet 1 of Excel I created a Chart following indications from the Cella (A2: C13) and so far everything is OK.
Then using the vba code I created a function that transfers the newly created Chart to sheet 2.
Now my question is this: Since if I insert an object Key, Shapers, Chart etc ...!
and then the elimino from sheet 1
And then I insert another new one; The application itself renames me this object with a different ID from the previous one.
So my question is this: There would be a system always taking advantage of the VBA rather than writing the Sample Function (Worksheets ("Sheet1"). Shapes ("Chart 17"). Copy) where it is clearly highlighted that even the chart created by Nuovo would give me an error because the previous Chart was always called for example (Chart 16). There would not be a way that the procedure does not take into account the name and let me copy my ciart anyway on Sheet 2
Thanks from Now for All the help you will be willing to give me on Sincere Greetings from A.Maurizio
Trusted Members
Moderators
November 1, 2018
Assuming it's the only chart on the sheet, you can use this:
Sub Copia_Immagine_Chart_Sul_Foglio2() Dim MyChart Worksheets("Foglio1").ChartObjects(1).Copy Worksheets("Foglio2").Paste Destination:=Worksheets("Foglio2").Range("A3") Worksheets("Foglio1").Range("A3").Copy Destination:=Worksheets("Foglio2").Range("A3") Foglio2.Range("A3").Clear Worksheets("Foglio1").ChartObjects(1).Delete End Sub By the way, I don't understand why you copy and paste A3 and then clear it again?
June 26, 2016
Hello Velouria
Thank you for your practical and technical support
Your function is very interesting
But to re-address your question; Quote: ("Why Copy a cell on Sheet 2, then Cancel it!")
Answer: Because not only initially without paying much attention to the formality of my work; I also took into consideration the fact of Copying the entire section of cells that had allowed me to create the Chart.
Then at a later moment I realized that it was a silly thing to copy everything; When: Not only did I already have the original data on sheet 1; But also because it would not have served me as a source, as I only wanted the Created Chart.
That's all !!!!!!
1 Guest(s)