save on leaving a cell

  • Thread starter Thread starter mikewild2000
  • Start date Start date
M

mikewild2000

I would like to save the workbook when the user moves out of cell D7 (o
after updating cell D7)

same as pressing ctrl+s on the keyboard.

but to do this in vba - any idea
 
Mike,

After updating D7

Private Sub Worksheet_Change(ByVal Target As Range)

If Target.Address = "$D$7" Then
ThisWorkbook.Save
End If

End Sub

in the sheet code module.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 
Thank you Bob - works a Dream.

However, took me a while to file the Sheet code modual.

I was inserting a modual via the insert menu.

What i did was highlight "sheet1" in Excel objects than under the vie
menu, click code then copied your code in.

Learning all the tim
 
Mike,

That's good. I bet that finding it out for yourself will be more valuable
for you in the future that it would have been if I had told you all that in
detail (although it was not a deliberate ploy on my part<vbg>). There are
other ways to do it (via the VB IDE) but you found what I think is the best
way.

Good luck with it all.

Regards

Bob
 
Back
Top