+ Reply to Thread
Results 1 to 5 of 5

Macro to record the Username in the first cell of a row after that row has been edited.

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    03-30-2009
    Location
    dublin
    MS-Off Ver
    Excel 2007
    Posts
    104

    Macro to record the Username in the first cell of a row after that row has been edited.

    Evening All,

    I have a need to display the username and the date and time in the first cell of a row, when that row (from Col B to Col GH) has been edited.

    IE If i type into the cell B2 or any cell in row 2 as far as Col GH, i would like the A2 cell to record the user name and Date and time [now()]

    Regards

    Bajdr

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Macro to record the Username in the first cell of a row after that row has been edited

    Right-click the sheet tab, select VIEW CODE, then paste in this event macro:

    Option Explicit
    
    Private Sub Worksheet_Change(ByVal Target As Range)
    Dim cell As Range
    
    For Each cell In Target
        If cell.Column > 1 Then
            Application.EnableEvents = False
            Range("A" & cell.Row).Value = Environ("Username") & " " & Format(Now, "MM-DD-YY h:mm AM/PM")
            Application.EnableEvents = True
        End If
    Next cell
    
    End Sub
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  3. #3
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,524

    Re: Macro to record the Username in the first cell of a row after that row has been edited

    Could you not use the code from your previous thread and just change the columns to B:GH ?

    If not let us know.

  4. #4
    Forum Contributor
    Join Date
    03-30-2009
    Location
    dublin
    MS-Off Ver
    Excel 2007
    Posts
    104

    Re: Macro to record the Username in the first cell of a row after that row has been edited

    Thank you JBeaucaire,

    This code does exactly what i need. I can see the differences in the two codes but as my know ledge of VBA is limited i don't understand the nuances

    Kind Regards

    Bajdr

  5. #5
    Forum Contributor
    Join Date
    03-30-2009
    Location
    dublin
    MS-Off Ver
    Excel 2007
    Posts
    104

    Re: Macro to record the Username in the first cell of a row after that row has been edited

    Sorry Davesecxcel,

    the problem i have with the code from the previous thread is that when i use it now it updates the next row everytime i update an existing row.
    This code i need to only update when the particular row is added to or updated.
    ie If i only complete 10 rows, then only a1 to a10 will have the username and now. if i update/edit any of the rows only the column A cell will on that row will update.

+ 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