How to save a copy of an excel sheet using macros?

Closed
guido09 Posts 1 Registration date Sunday February 11, 2018 Status Member Last seen February 11, 2018 - Updated on Feb 11, 2018 at 03:05 PM
 Blocked Profile - Feb 13, 2018 at 04:59 PM
Hello,

excel guru's,

I am struggling with a problem which should be easy (i think), but with my lack of knowledge of VBA i am stuck.
I have an excel file where daily data from production batches is filled in. It calculates some waste numbers etc.
I can select different products (though Vlookup's) to change some cells with text and/or values.
What i need is that with a click on a macro, a copy of sheet1 is being saved in a new file (workbook) where the filename is coming from a cell from the original file. After the succesfull save (pop up maybe?) the original file should keep its original name.

1 reply

Blocked Profile
Feb 12, 2018 at 05:02 PM
This is simple,

Go to file, select SAVE as, and go for it!

OR, record a macro of all that you wish for this "EASY BUTTON" to do, and assign a key, and viola!
0
Thanks for your solution, but i knew this already and this is not what i want. I want it automated by a click on a button. With a recorded macro it isnt possible to save the file with a specific name from a cell.
0
Blocked Profile
Feb 13, 2018 at 04:59 PM
Sure it is. Get the cell value, store it as a variable, and save it.

fName = thisworkbook.worksheets("sheet1").range("A1").value
thisworkbook.worksheets("Sheet1").SaveAs Filename:=fName
0