ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   save on leaving a cell (https://www.excelbanter.com/excel-programming/286306-save-leaving-cell.html)

mikewild2000[_4_]

save on leaving a cell
 
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

--
Message posted from http://www.ExcelForum.com


Bob Phillips[_6_]

save on leaving a cell
 
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)

"mikewild2000" wrote in message
...
I would like to save the workbook when the user moves out of cell D7 (or
after updating cell D7)

same as pressing ctrl+s on the keyboard.

but to do this in vba - any ideas


---
Message posted from http://www.ExcelForum.com/





mikewild2000[_5_]

save on leaving a cell
 
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

--
Message posted from http://www.ExcelForum.com


Bob Phillips[_6_]

save on leaving a cell
 
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

"mikewild2000" wrote in message
...
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 view
menu, click code then copied your code in.

Learning all the time


---
Message posted from http://www.ExcelForum.com/





All times are GMT +1. The time now is 02:48 PM.

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