Hello
I have been trying to find a macro that autamatically fills 3 different cells with date, updated date and name of user, when someone fills certain cells in a worksheet.
i have 2 macros that work independently. but i cant make them work together:
(Optimally i would like to have the macro for username, fill C7 with username when B7 is changed and so on down to B307) WE are 15 peaople who uses the worksheet and its nice to see whos done the changes.
----------------
And
I have been trying to find a macro that autamatically fills 3 different cells with date, updated date and name of user, when someone fills certain cells in a worksheet.
i have 2 macros that work independently. but i cant make them work together:
(Optimally i would like to have the macro for username, fill C7 with username when B7 is changed and so on down to B307) WE are 15 peaople who uses the worksheet and its nice to see whos done the changes.
----------------
VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)
'Timestamp Data
' TeachExcel.com
Dim myTableRange As Range
Dim myDateTimeRange As Range
Dim myUpdatedRange As Range
'Your data table range
Set myTableRange = Range("B7:F306")
'Check if the changed cell is in the data tabe or not.
If Intersect(Target, myTableRange) Is Nothing Then Exit Sub
'Stop events from running
Application.EnableEvents = False
'Column for the date/time
Set myDateTimeRange = Range("N" & Target.Row)
'Column for last updated date/time
Set myUpdatedRange = Range("O" & Target.Row)
'Determine if the input date/time should change
If myDateTimeRange.Value = "" Then
myDateTimeRange.Value = Now
End If
'Update the updated date/time value
myUpdatedRange.Value = Now
'Turn events back on
Application.EnableEvents = True
End Sub
And
VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)
'By Excel 10 Tutorial
If Target.Cells.Count > 1 Then Exit Sub
If Not Intersect(Target, Range("B7:B306")) Is Nothing Then
With Target(1, 2)
.Value = Application.UserName
.EntireColumn.AutoFit
End With
End If
End Sub