+ Reply to Thread
Results 1 to 4 of 4

Is this possible

Hybrid View

Michael Wise Is this possible 08-21-2007, 04:10 PM
Leith Ross Hello Michael, Yes, it... 08-21-2007, 04:18 PM
Michael Wise After 08-21-2007, 04:56 PM
Leith Ross Hello Michael, Place this... 08-21-2007, 05:30 PM
  1. #1
    Registered User
    Join Date
    03-10-2004
    Posts
    45

    Is this possible

    I'm wanting to create a log of changes made in an excel file. I'm looking for this log to 1. let me know what cell was modified and 2. notify me by email of the modification. Not sure where to begin on this one.
    Thanks,
    Michael

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,259
    Hello Michael,

    Yes, it can. When do you want to be emailed? After the workbook is closed? If you get emailed every time a user makes a change, you are going to be knee deep in emails.

    Sincerely,
    Leith Ross

  3. #3
    Registered User
    Join Date
    03-10-2004
    Posts
    45

    After

    Lieth, I would want it after the workbook is closed. thxs

  4. #4
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,259
    Hello Michael,

    Place this code into a Standard VBA module. This will create your log file as a tab delimited file. There are 5 columns: (1) The date as Aug-21-2007, (2) The time in 24 hour format as hours:minutes:seconds, (3) The Worksheet's name, (4) The address of the cells that were changed, (5) The logon name of the user. Change the variable FileLoc to the directory and file name you want.

    Log File Macro
    Function LogCellChanges(Cell As Range)
    
      Dim FileLoc As String
      Dim FileNum As Integer
      
        FileNum = FreeFile
        FileLoc = "C:\xlChanges.log"
        
          Open FileLoc For Append As #FileNum
            Print #FileNum, Format(Now(), "mmm-dd-yyyy"); Tab; Format(Now(), "hh:mm:ss"); Tab; _
                  Cell.Parent.name; Tab; Cell.Address; Tab; Environ$("UserName")
          Close FileNum
        
    End Function
    To Install the Macro:
    1. Copy the Macro code above using CTRL+C
    2. Open Excel and Right Click on any Sheet Tab
    3. Click on View Code in the pop up menu
    4. Use ALT+I to activate the VBE Insert Menu
    5. Press the letter m to insert a Standard Module
    6. Paste the macro code using CTRL+V
    7. Save the macro using CTRL+S
    8. Close the VBE and return to excel using ALT+Q

    Worksheet Macro
    Place this code in each worksheet you want to log changes for.
    Private Sub Worksheet_Change(ByVal Target As Range)
      LogCellChanges(Target)
    End Sub
    Installing the Worksheet_Change() Event Macro
    1. Copy the Macro code above using CTRL+C
    2. Open Excel and Right Click the Sheet Tab the macro will run on
    3. Click on View Code in the pop up menu
    4. PressCTRL+V to Paste the macro code
    5. Press CTRL+S to Save the macro code in the workbook
    6. Close the VBE and return to excel using ALT+Q

    I need to work on the email portion of the macro code next.

    Sincerely,
    Leith Ross
    Last edited by Leith Ross; 08-21-2007 at 05:32 PM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1