Redefine my macro

chobanne

Active Member
Joined
Jul 3, 2011
Messages
269
Hello all,

I made one excel macro enabled workbook file (xlsm) in which i have some foundation calculation. In it, I created a complicated macro, that frees file from all unnecessary sheets, other macros, calculations, etc., and on the only remaining sheet, it only attaches values in all cells regardless of formulas. In other words, it would be a file from which I would print my calculation or a file that I would share with others without them using my created macros and calculations. The problem is that when I start that macro my original file is lost and I can't change the calculations and use former macros anymore.

I would greatly appreciate it, if someone could help me to redefine my macro, adding some lines at the beginning and in the end, so that two new files can be created from the existing file, using the rules explained below.

The first file should be same as the original file, just saved under a different name and remains open after finishing the macro command. The new file name must be the combination of the value from active sheet cell A1, text defined as "-", and the value from active sheet cell A2, and should be displayed like this "activesheetcellvalueA1 - activesheetcellvalueA2.xlms ". The file must be saved in the same folder where original file was.

The second file should be obtained from a copy of the first file. In second file, first i need my macro to be applied, and after that, the file must be saved with new name and closed after finishing the macro command. The new file name must be the combination of the value from active sheet cell B1, text defined as "-", and the value from active sheet cell B2, and should be displayed like this "activesheetcellvalueB1 - activesheetcellvalueB2.xlsx ". The file must be saved in the subfolder PRINT of folder where original file was. If the PRINT subfolder does not exist, the macro should created it.

Please, mark me the line where to put my original macro inside redefined one.
Please note my macro is written for active file so the second file must be active for use.
Also note that it will be very nice if macro could make everything hidden while making second file (that there is no visible opening of duplicate file in windows)

I hope you understand me. If there are any questions, I am available

Thank you
 

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.

Forum statistics

Threads
1,224,823
Messages
6,181,179
Members
453,021
Latest member
Justyna P

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top