The worksheet change event I gave you didn't include making more changes to the active sheet. When you do that, you have to turn off macros first, else the ws_change macro can keep triggering itself over and over...could be problematic.
My edits on your updated version of that macro:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim Cell As Range
Dim NR As Long
Application.EnableEvents = False
For Each Cell In Target
If Not Intersect(Cell, Range("C:C,I:I")) Is Nothing Then
With Cell.Offset(, 1) 'using the cell to the right...
.Value = Time '...add the time
.EntireColumn.AutoFit 'autofit that column
End With
ElseIf Cell.Column = 8 And Cell = "Closed" Then
Cell.Offset(, 1) = Date 'add date one cell to the right, in column 9
Cell.Offset(, 2) = Time 'add time two cells to the right, in column 10
With Sheets("Summary Sheet")
'find the next empty row on sheet3
NR = .Range("A" & .Rows.Count).End(xlUp).Row + 1
'put the value from A into sheet3 column A
.Range("A" & NR).Value = Range("C" & Cell.Row).Value
'put the values from G:H into sheet3 columns B:C
.Range("B" & NR).Resize(1, 2).Value = _
Range("E" & Cell.Row).Resize(1, 2).Value
.Range("D" & NR).Value = Range("I" & Cell.Row).Value
End With
ElseIf Cell.Column = 8 And Cell = "Open" Or Cell = "In Progress" Then
Cell.Offset(, 1).Resize(1, 2) = "N/A"
ElseIf Cell.Column = 8 And Cell = "" Then
Cell.Offset(, 1).Resize(1, 2) = ""
End If
Next Cell
Application.EnableEvents = True
End Sub
Other macro edits:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Cells.Count > 1 Then Exit Sub
If Target.Column = 3 Then
Calendar1.Left = Target.Left + Target.Width - Calendar1.Width
Calendar1.Top = Target.Top + Target.Height
Calendar1.Visible = True
' select Today's date in the Calendar
Calendar1.Value = Date
ElseIf Calendar1.Visible Then Calendar1.Visible = False
End If
End Sub
Sub DeleteLine()
' clear date, severity, comments, workorder, flags
ActiveCell.Resize(1, 9).ClearContents
End Sub
Sub DeleteEntireRow()
' Delete Date, car num, oscar pos, actual pos,temp,severity,hbd pos,loaded empty,sap,notify num,car tsl
ActiveCell.Resize(1, 11).Delete Shift:=xlUp
End Sub
Bookmarks