7. Exporting a Module, Range Function & WorkSheets in Excel VBA

Опубликовано: 15 Октябрь 2024
на канале: Learn data analytics with us
93
1

VBA PLAYLIST:    • Learn Excel VBA (Visual Basic for App...  

This seventh clip in this VBA video series shows how to export modules, ranges, and functions to be used across Microsoft Excel files.

hello guys my name is Scott and actually in this video I will show a vest that I can implement a macro or a module file that you have already pixels created for some worksheet and then you want to implement the same macro or module on a new sheet of the new sheet so if you guys remember that I have used this file in our previous video and in this one in this file I've created one macro in this file so if I go to this file as you can see that we have not used one file and within this module I have created this macro and by the help of this macro we have implemented some formatting changes into the following sheets 5 2006 2007 and 2008 so but suppose you also suppose you were working on this sheet and your colleague have sent you another sheet which have the honors the similar data but it's an updated sheet so I can go back to my folder way I have the data so I have two sheets here so school you I'm just giving an example so that's where you get this data set one month back you created a macro and you implemented that macro this she did this is the shield I'm talking about but suppose after a month you Colly have sent you an updated file which is this file which is the Excel format it don't have any macro in it but you know that the same macro that you have implemented on this sheet can can be used on the new sheet that you click have sent so now if I open the new sheet that you clean up cell so X in this sheet is all same as the sheet which we were working before but now you need to run your macro again and to make it to make to make it into a right forming and you want the sum of the amount paid by each respondent so then the question would be how you can do that so in order to do that you first have to go to the sheet where you have constructed you module or macro so I would go back to my actual sheet where I have the macro five billion and want to run it on the new sheet so I will first open it up and once the file will open I will go back my Developer tab and then I haven't go to visual they see in the visual basic this is the sheet 2 this is the module 1 or the court file over which it contains my macro so what I will do if you want to change its name so suppose if you want to change the body then you can change it right now so suppose if I want to call it do again so because actually this module contains the macro okay so I will I can rename it you can see my body would get rehear and now if I want to so the first thing they didn't have to do you have to export this this module into into the folder really one so I will say it's four five so um so it's you can save it anywhere you want in your directory so I will be saving it into VB videos rate function and then it's a same so now everything is done from related to this file I can close this window I can also close this file where I have constructed my macro active in the first place so I will close it you can save it so now the point is that I want to implement the module or the macro that I have exported by this name and I want to use this macro into the new excel sheet that you only have sent which don't have any macro or module in it so I will open that file and now I will go to my developer tab and after going to my developer tab I will go to visual basic and after we will be saying this is my actual sheet which is running so now whatever go I will go to this button I will go here and I will I will click on this mo