
Originally Posted by
vandanavai
Hi,
I don't konw if this is possible. I have on macro which copies formula in Range A1: A10 and paste values in same range ( through paste special - values). Everytime before file is saved and closed, user has to run this macro. But sometinmes user forgets to do so and some problem is to be faced. So I want to run this macro automatically when file is saved and closed
Please help me.
Hi,
Private Sub Workbook_BeforeClose(Cancel As Boolean)
'
ActiveSheet.Range("A1:A10").Select
Selection.Copy
Range("A1").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
End Sub
should work, paste this into the Workbook (Alt & F11 for VB Editor, select Workbook )
Let me know how you go
---
---
Bookmarks