ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   SavingExcelChanges (https://www.excelbanter.com/excel-programming/291557-savingexcelchanges.html)

mike

SavingExcelChanges
 
I have a question about saving Excel changes
I have a macro that when activated by an operator copies data from worksheet A to worksheet D
How can I automatically save the copied data in Worksheet D in case the operator hits the x o
closes workbook without saving changes

thank


SuperJas

SavingExcelChanges
 
Hi Mike

You'll need to add this line of code after the pasting has been done

----------------------
Thisworkbook.Sav
----------------------

This will save the whole workbook automatically. Note that if a series of pasting is done, it may be annoying to the user for having to wait for the file to save each time, so you may want to put this code within the BeforeClose event so that it only saves once

SuperJas.

mike

SavingExcelChanges
 
Hi Super Jas
Thanks for the help. This works very well.
Mike

----- SuperJas wrote: -----

Hi Mike,

You'll need to add this line of code after the pasting has been done:

-----------------------
Thisworkbook.Save
-----------------------

This will save the whole workbook automatically. Note that if a series of pasting is done, it may be annoying to the user for having to wait for the file to save each time, so you may want to put this code within the BeforeClose event so that it only saves once.

SuperJas.


All times are GMT +1. The time now is 10:37 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com