I have workbook contain macro. The report name is ppAug22.xlsm. Every month I will save new workbook - ppSep22.xlsm containing macro inside the new workbook. I put all the file path and new file name in sheet1 inside ppAug22.xlsm. After I run the macro in ppAug22.xlsm. It only help to save the new file ppSep22.xlsm. Other part macro cannot run. Could anyone have suggestion to solve it?
Regards,
Joe
Related
I have a macro, and I am struggeling with saving. The macro:
opens second workbook from SharePoint
unprotects it
unprotects a sheet in the original workbook
copies line(s)
pastes those line(s) in the second workbook
protects the sheet in the second workbook
saves the second workbook
closes it
protects the sheet in original workbook
I have this macro in 4 files, always 1 original file - 1 second file. Two files are without any problems, but the other 2 files, I can't save the second file. It says that there is already a file with this name, and asks if I want to rewrite it.Why does it ask that, when I am using the function .Save?Or, if this cannot be managed, how do I write in the macro that it should choose - yes, rewrite?
Thank you.
I tried to use the combined function Close SaveChanges:=True, but it didnt help.
I'm trying to write a macro that takes Sheet1 from another, already open, workbook and copy it into a the workbook that will use the data. The macro will be run from the workbook that will be receiving the copied sheet and the file I want the data from will always be named the same.
I've tried the follow code, but it either just copies incorrectly or doesn't work.
Workbooks("FileIWantToCopyFrom.XLSX").Sheets("Sheet1").Copy
ActiveWorkbook.Worksheets("FileIWantToCopyFrom.XLSX").Select
Sheets("Sheet1").Copy After:=Workbooks("Book1").Sheets(1)
Any help would be much appreciated. Thanks!
I have been unable to find a solution for this problem: When adding a new worksheet in an Excel workbook, the active cell moves to D20. This behavior is consistent across ALL workbooks that I open or use (new or opening existing workbooks). There are no macros on "ThisWorkbook" or any of the sheets. Has anyone seen this before?
Did you (or someone else) maybe create a custom sheet template?
https://www.rondebruin.nl/win/s9/win016.htm
I saved a single-sheet workbook (with D20 selected) as "sheet.xlt" in my XLSTART folder, and each time I add a new sheet in a workbook I get that same selection in the new sheet.
I am working on a vba project. My requirement is, to delete/move a existing sheet from an excel file to a new excel file using vba code. That means to Save specific sheet to a new workbook. I have tried it alot but the file which is being saved is not a new workbook. It is the existing one.
Code is as below :
xlWorkbook.Sheets("Sheet3").Copy -- this line opens sheet3 as a new workbook
xlWorkbook.Sheets("Sheet3").SaveAs "***Path where file is be saved***", FileFormat:=56 -- this line save the original excel file including Sheet1 and Sheet2. But requirement is only having Sheet3.
xlWorkbook.Sheets("Sheet3").Delete -- this line delete the Sheet3 from original as expected.
I can not use any kind of reference file or Excel 12.0 Object library. So
Please if anyone can suggest me or help me. Will appreciate.
Use two lines:
xlWorkbook.Sheets("Sheet3").Copy
xlWorkbook.Application.ActiveWorkbook.SaveAs "***Path where file is be saved***", FileFormat:=56
Please, could you tell me if the following is possible in VBA:
I need to write code that copies a sheet from my workbook to a new freshly created xls file. BUT, the sheet I wanna copy has a Macro behind (it's actually a WorkSheet_Change event handler) that I also want to copy to the new file.
Many thanks
Kind regards,
Miloud B
You can Export the code from the original and then Import it into the copy.
Here's an article that shows some code for doing this: Macro to Add a Macro to New Workbooks