Hello All,
I am trying to put a macro together that will be triggered when a value is entered into a cell. The macro would then place the current time/date in a different cell along with placing the username used in another cell. I have figured out how to have the cell event to be triggered using the below code but I am lost after that. Any help you can provide would be great.
Private Sub Worksheet_Change(ByVal Target As Excel.Range)
Dim VRange As Range, MyCell As Integer
Set VRange = Range("D")
If Union(Target, VRange).Address = VRange.Address Then
ActiveCell.Offset(0, 5).Range("A1").Select
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
ActiveCell.Offset(0, -5).Range("A1").Select
Application.CutCopyMode = False
End If
ActiveCell.Offset(0, 6).Range("A1").Select
Dim sUserName As String
sUserName = GetNTLoginName
End Sub
I am trying to put a macro together that will be triggered when a value is entered into a cell. The macro would then place the current time/date in a different cell along with placing the username used in another cell. I have figured out how to have the cell event to be triggered using the below code but I am lost after that. Any help you can provide would be great.
Private Sub Worksheet_Change(ByVal Target As Excel.Range)
Dim VRange As Range, MyCell As Integer
Set VRange = Range("D")
If Union(Target, VRange).Address = VRange.Address Then
ActiveCell.Offset(0, 5).Range("A1").Select
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
ActiveCell.Offset(0, -5).Range("A1").Select
Application.CutCopyMode = False
End If
ActiveCell.Offset(0, 6).Range("A1").Select
Dim sUserName As String
sUserName = GetNTLoginName
End Sub