Updated June 12, 2023
PART-20 – Visual Basic – Chart in another sheet
Transcript For Video – Visual Basic – Chart in another sheet
Video on Visual Basic – Chart in another sheet – Let us now take this discursion ahead and introduce more complexities let say for example I don’t want to have this chart in sheet 1 but I want to have chart in sheet 2 so how is that possible so for doing that again I will go back and record Macro and logically connect manipulating the same how it will be a done lets record the macro only for the incremental activity right so once the chart is here you want to kind of select the chart cut it and may be paste it in sheet 2 so that what we will do and record the incremental code so I’ll record Macro cut paste what I will probably I will choose the name as and I’ll click on Ok for this I’ll start with selecting the chart I’ll cut I’ll go to sheet number 2 this is cell no A1 and paste as CRTL V ok so CTRL C and CTRL V so that what we have done here so as we can see here the chart is being paste it now we can stop the code and look at what is incremental code that was made here so let’s select the code which we wanted to create cut paste and go to edit and let see what has happen here this is nothing but active sheet. Chart object see this is 10. Activate now; please remember that, as we have explain earlier, this may not be required; what has happen here this is nothing but active sheet. chart object, see this is 10. Activate now; please remember that, as we have explain earlier, this may not be required at all because you may be already working in the active chart itself. You want cut this so active chart. Cut went into to sheet 2, selected range A1 and active sheet. Paste is what we did so this is what is the incremental code I will not copy this first because of the reason we had explain earlier so let me copy this and move to my other sub routine which is regarding the chart sample so I’ll introduce this here so that it is transferred only after it is created so I cannot do this I cannot introduce the code here at the top because chart has not yet been prepared so I need to have it only after it was prepared so let’s keep it here and let’s hope that this whole chart runs in the fashion it was desired to so let me delete this and there is no chart here so let’s go back and look at the Macros, the Macros name is chart sample and lets run this and you can see that sheet 2 now having your chart right so you can actually play with lot of these option here we had selected range A1 so say for example that why the chart actually started with your cell A1 here now say for example you wanted to have the chat here starting from J2 ok this is where you wanted start to start from J2 so you could have just change this and J2 and your chart will be cut and paste in cell no J2 let see if this work just go to macros select the macro and run so as we can see your chart actually starts from J2 so it good way to look at you know these smaller tweaking in order to suit yours names from the automation purposes Ok so for the time being I’ll just revert back to A1 which was the original case now let us take another step ahead and kind of add another level of customization say for example I want to kind of move this chart to new sheet.