ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Save on sheet shift (https://www.excelbanter.com/excel-programming/395772-save-sheet-shift.html)

om

Save on sheet shift
 
Hi there

I am new to this VBA, but i will try to give it a go.

I would like the workbook to be saved when the user shifts away from Sheet1
to be certain that content of Sheet1 is always saved.

I suppose that the piece of code should be placed in a VBA module under the
workbook

Thanks Ole


Mike H

Save on sheet shift
 
Try this:

Private Sub Worksheet_Deactivate()
ActiveWorkbook.Save
End Sub

Right click sheet1 sheet tab, view code and paste this in

Mike

"OM" wrote:

Hi there

I am new to this VBA, but i will try to give it a go.

I would like the workbook to be saved when the user shifts away from Sheet1
to be certain that content of Sheet1 is always saved.

I suppose that the piece of code should be placed in a VBA module under the
workbook

Thanks Ole


om

Save on sheet shift
 
Hi Mike

Works fine, thanks a lot

"Mike H" skrev:

Try this:

Private Sub Worksheet_Deactivate()
ActiveWorkbook.Save
End Sub

Right click sheet1 sheet tab, view code and paste this in

Mike

"OM" wrote:

Hi there

I am new to this VBA, but i will try to give it a go.

I would like the workbook to be saved when the user shifts away from Sheet1
to be certain that content of Sheet1 is always saved.

I suppose that the piece of code should be placed in a VBA module under the
workbook

Thanks Ole



All times are GMT +1. The time now is 09:31 AM.

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