ossosso
08-07-2018, 01:02 PM
Hi,
let me say that I red a lot of topics on how to figure out this problem. I've collected some VBA code to try, but with no success.
I would like that an .xlsm file is automatically saved each time that I add or update content into a cell.
1. I've created a new .xlsm file.
2. Right click on the sheet name on the bottom and click on "view code"
3. Paste the code, pressed ctrl s to save VBA code and close
4. Once in excel I type something in one cell.
5. I press ALT+F4 to close and the application asks me if I want to save the document. But it shouldn't. Why it doesn't save automatically ?
Here the codes I've tried, one by one.
Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, Me.Range("A1:AA1000")) Is Nothing Then
ThisWorkbook.Save
End If
End Sub
Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
ActiveWorkbook.Save
End Sub
Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, Me.Range("A1:D20")) Is Nothing Then
ThisWorkbook.Save
End If
End Sub
Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range
ActiveWorkbook.Save
End Sub
Option Explicit
Private Sub Workbook_Open()
ONTIMER_S = Now() + TimeValue("00:00:01)
Application.OnTime ONTIMER_S, "SaveBook"
End Sub
Private Sub Workbook_BeforeClose(Cancel As Boolean)
Application.OnTime ONTIMER_S, "SaveBook", , False
End Sub
Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Range("A1:F20"), Target) Is Nothing Then ActiveWorkbook.Save
End Sub
I'm missing something?
Thanks a lot.
let me say that I red a lot of topics on how to figure out this problem. I've collected some VBA code to try, but with no success.
I would like that an .xlsm file is automatically saved each time that I add or update content into a cell.
1. I've created a new .xlsm file.
2. Right click on the sheet name on the bottom and click on "view code"
3. Paste the code, pressed ctrl s to save VBA code and close
4. Once in excel I type something in one cell.
5. I press ALT+F4 to close and the application asks me if I want to save the document. But it shouldn't. Why it doesn't save automatically ?
Here the codes I've tried, one by one.
Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, Me.Range("A1:AA1000")) Is Nothing Then
ThisWorkbook.Save
End If
End Sub
Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
ActiveWorkbook.Save
End Sub
Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, Me.Range("A1:D20")) Is Nothing Then
ThisWorkbook.Save
End If
End Sub
Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range
ActiveWorkbook.Save
End Sub
Option Explicit
Private Sub Workbook_Open()
ONTIMER_S = Now() + TimeValue("00:00:01)
Application.OnTime ONTIMER_S, "SaveBook"
End Sub
Private Sub Workbook_BeforeClose(Cancel As Boolean)
Application.OnTime ONTIMER_S, "SaveBook", , False
End Sub
Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Range("A1:F20"), Target) Is Nothing Then ActiveWorkbook.Save
End Sub
I'm missing something?
Thanks a lot.