From workbook press Alt+F11 to launch VBE (Visual Basic Editor). From the
left treeview search for the workbook name and click on + to expand it.
Within that you should see the following
VBAProject(Your_Filename)
Microsoft Excel Objects
Sheet1(Sheet1)
Sheet2(Sheet2)
Sheet3(Sheet3)
This Workbook
Double click 'This WorkBook' and paste the below code to the right code pane.
Private Sub Workbook_SheetSelectionChange(ByVal Sh As Object, ByVal Target
As Range)
Static lngRow As Long
If Target.Row <> lngRow Then Me.Save
lngRow = Target.Row
End Sub
Jacob's code as written requires you to select a cell in a different row
before the save takes place.
Do you want to save when you select anywhere on any worksheet?
Private Sub Workbook_SheetSelectionChange(ByVal Sh As _
Object, ByVal Target As Range)
Me.Save
End Sub
Seems a little excessive to me.
Gord Dibben MS Excel MVP
Ask a Question
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.