How to add a ready macro to excel

Closed
lenin - Jul 11, 2009 at 01:19 PM
venkat1926 Posts 1863 Registration date Sunday June 14, 2009 Status Contributor Last seen August 7, 2021 - Jul 11, 2009 at 09:04 PM
Hello,
I have downloaded a macro from a blog to keep a track of time and date when a cell was modified last. Please help me how to add it to the excel. I have tried pasting it in view code and getting the time and date until i close it once, but when I reopen it I don't find the macro again.
Related:

1 response

venkat1926 Posts 1863 Registration date Sunday June 14, 2009 Status Contributor Last seen August 7, 2021 811
Jul 11, 2009 at 09:04 PM
Its depends upon whether it is a standard macro or an event handler. Standard macro start with
sub <name of the sub>()

e.g. sub test()

click alt+F11 and click control+R you will see the names of the open workbookks. highlight the relevant workbook and click insert(menu) +module then the vbedtior opens and there you copy paste the macro

If it is event handler then it starts with

Private Sub Worksheet_SelectionChange(ByVal Target As Range) or
Private Sub Worksheet_Calculate()
(note worksheet after sub)

this means it is a sheet event handler (for a particular sheet ).in such case right click particular sheet tab and click view code and copy paste the macro there .

If it is workbook event handler it will start with
Private Sub Workbook_SheetCalculate(ByVal Sh As Object)
(see the workbook after sub)

In such a case right lclick the excel icon on the left of file menu and click view code and there copy paste the macro.

if there is any other doubt post your doubt. what is the version of your excel.?
0