Patriot2879
Well-known Member
- Joined
- Feb 1, 2018
- Messages
- 1,259
- Office Version
- 2010
- Platform
- Windows
Hello the below code I hope you can help, I have the 2 codes below that need to run simultaneously, but at moment they don't, this is to work on a cell value change, the last code only works if you press play. hope you can help please. thex2 codes below are placed in sheet 8 (SMART Locate)
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim WorkRng As Range
Dim Rng As Range
Dim xOffsetColumn As Integer
Set WorkRng = Intersect(Range("H:h"), Target)
xOffsetColumn = -6
If Not WorkRng Is Nothing Then
Application.EnableEvents = False
For Each Rng In WorkRng
If Not VBA.IsEmpty(Rng.Value) Then
Rng.Offset(0, xOffsetColumn).Value = Now
Rng.Offset(0, xOffsetColumn).NumberFormat = "dd/mm/yyyy hh:mm"
Else
Rng.Offset(0, xOffsetColumn).ClearContents
End If
Next
Application.EnableEvents = True
End If
End Sub
Private Sub Initialise()
Dim emptyrow As Long
With ThisWorkbook.Sheets("SMART Locate")
emptyrow = .Cells(Rows.Count, "H").End(xlUp).Row + 1
.Cells(emptyrow, 10).Value = Environ("USERNAME")
End With
End Sub