简体   繁体   中英

vba before save event change cell value?

I am trying to set the value of my cell R3 to 'RDC Mode' when the user hits save.

The value which has changed needs to be saved as the workbook is saving.

For some reason this code won't change my value.

Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
Worksheets("Place Orders").Range("R3").Value = "RDC Mode"
End Sub

Please can someone show me where i am going wrong?

You code works if it is located in the proper place.

在此处输入图片说明

It goes in the ThisWorkbook code area.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM