Macro assist required

  • Thread starter Thread starter Ram
  • Start date Start date
R

Ram

Hi,

I have no idea how to create macro's so can one of up you help.

When I save a sheet I wish to invoke the 'OnSave' command then input the
date/time into a cell or sheet to record when the last update was.


FIA
Ram
 
Hi
this would require either an event procedure or a user defined function
that shows the last save date. For the first one put the following code
in your workbook module (see: http://www.cpearson.com/excel/events.htm)
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As
Boolean)
me.worksheets("sheet1").value=Date
End Sub
 
HI,

go to the VBA editor ( alt + f11) on the left side click on the "This
workbook" past the below code on the code pane.


Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As
Boolean)
Range("a5").Value = "Last save on " & Now
End Sub


Cesar Zapata
 
Cesar Zapata said:
HI,

go to the VBA editor ( alt + f11) on the left side click on the "This
workbook" past the below code on the code pane.


Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As
Boolean)
Range("a5").Value = "Last save on " & Now
End Sub


Cesar Zapata

Thanks, Cesar that works a treat with a bit of modifying

Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As
Boolean)

Worksheets(1).Range("a5").Value = "Last saved on " & Now & " By " &
Application.UserName
End Sub

Ram.
 
Back
Top