saving without prompt within code

T

tawnee jamison

I am using this code:

Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range)
ActiveWorkbook.SaveAs FileName:="J:\agency\"
ActiveSheet.Range("s43")
End Sub

to save whenever an employee changes this document. Can I have it sav
without prompting the user?

Thanks in advance.

Tawne
 
H

Harald Staff

Hi Tawnee

Worksheet_SelectionChange runs whenever the user goes to another cell. You
don't want to do this.

HTH. Best wishes Harald
 
D

Dave Peterson

And the first time this saved, the user could be editing a different workbook
than they started with.

But once you resolve that problem that Harald mentioned (maybe just putting a
button on the worksheet???), you can hide the overwrite prompt with:

application.displayalerts = false
'your code to save
application.displayalerts = true

Once the user saves it to that new name, do you really want it save somewhere
else if S43 changes?
 
Top