![]() |
copying VBA from one Excel file to another
I have collected several spreadsheets calculators useful for different
applications. To protect them from users changing stuff, and losing the files, I have combined them all in one file. I have then created a VBA code and changed the file into an addin. When the file is opened, the user gets an extra menu on the menu bar, with a drop down list of the different calculators I have collected. When the user picks the calculator he wants, the macro creates a new xl file and copies the appropriate xl sheet that contains the desired calculator from the addin to a new sheet. Simple, effective, and good housekeeping. The problem occured when I bumped into a calculator that contains a number of VBA functions in a module. Copying the sheet over won't do the trick any more. Is there a way to copy over the functions as well. Or, is there a way to make the functions (and maybe sub statements) located in the addin be called up from the spreadsheet I copy over? The functions are called up from cells in the worksheet as follows: =interplookup2d(D4;D3;$C$22:$O$29) |
copying VBA from one Excel file to another
Create a macro that puts the functions into the worksheet like this
Range("A1").formula = "=interplookup2d(D4;D3;$C$22:$O$29)" either when you install the add-in or when the workbook is opened rn that macro that puts the functions into the workbook. "Okieviking" wrote: I have collected several spreadsheets calculators useful for different applications. To protect them from users changing stuff, and losing the files, I have combined them all in one file. I have then created a VBA code and changed the file into an addin. When the file is opened, the user gets an extra menu on the menu bar, with a drop down list of the different calculators I have collected. When the user picks the calculator he wants, the macro creates a new xl file and copies the appropriate xl sheet that contains the desired calculator from the addin to a new sheet. Simple, effective, and good housekeeping. The problem occured when I bumped into a calculator that contains a number of VBA functions in a module. Copying the sheet over won't do the trick any more. Is there a way to copy over the functions as well. Or, is there a way to make the functions (and maybe sub statements) located in the addin be called up from the spreadsheet I copy over? The functions are called up from cells in the worksheet as follows: =interplookup2d(D4;D3;$C$22:$O$29) |
All times are GMT +1. The time now is 06:23 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com