VBA query

  • Hi,


    One of my colleagues is looking into designing a log to capture information on what user has updated sections of another spreadsheet and he's asked me to have a look but i completely forgotten how to use VB (its been so long). From the looks of it both sheets are in the same format and he only wants to document the date and username for when that perticular cell has been modified.


    i came up with the below but it doesn't seem to be working, am i missing anything or is there a better way of working this out?


    Code
    Private Sub Worksheet_Change(ByVal Target As Range)
        If Target.Column < 4 Or Target.Column > 60 Then Exit Sub
        Application.EnableEvents = False
        Worksheets("User Edits").Cells(Target.Row, Target.Column).Value = Worksheets("User Edits").Cells(Target.Row, Target.Column).Value & Format(Now, "dd/mm") & " " & Environ("USERNAME") & ", "
        Application.EnableEvents = True
    End Sub


    many thanks in advance.


    CW

  • Re: VBA query


    Hi CWilliams87,
    Welcome to the forum
    please add code tags to your VBA in the future
    possibly


  • Re: VBA query


    Hi Pike,


    Thanks for the info, are you able to to explain the below? i've never used intesect before and i think i need to extend the range.


    Quote

    If Not Intersect(Target, Range("C:F")) Is Nothing Then
    Target = UCase(Target)


    The range i need to capture is D:AZ any column either side can be excluded.


    many thanks again for your help.


    Regards,


    Cw

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!