cooleomter
New Member
- Joined
- Sep 3, 2024
- Messages
- 25
- Office Version
- 365
- 2021
- Platform
- Windows
The COde works if i only delete one by one.. But if i Highlight many cells and delete all at once.. it debugs
Need help please,... here is my code:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim nextRow As Long
Set historyWks = ActiveSheet
'Check if the changed cells are in the specified range
If Not Intersect(Target, Me.Range("C8:C3000")) Is Nothing Then
' to check cell if empty. or i delete
If Target.Cells.Value = " " Or IsEmpty(Target) Then Exit Sub 'Check if target cell is empty
With historyWks
nextRow = .Cells(.Rows.Count, "C").End(xlUp).Offset(0, 1).Row
End With
With historyWks
With .Cells(nextRow, "G")
.Value = Date
.NumberFormat = "mm/dd/yyyy"
End With
With .Cells(nextRow, "F")
.Value = Time
.NumberFormat = "h:mm:ss AM/PM"
End With
With .Cells(nextRow, "D")
.Value = Range("F1").Value 'pACKING OPERATOR
End With
With .Cells(nextRow, "H")
.Value = Range("D2").Value ' MODEL
End With
With .Cells(nextRow, "I")
.Value = Range("F2").Value ' wEIGHING OPERATOR
End With
End With
End If
End Sub
Need help please,... here is my code:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim nextRow As Long
Set historyWks = ActiveSheet
'Check if the changed cells are in the specified range
If Not Intersect(Target, Me.Range("C8:C3000")) Is Nothing Then
' to check cell if empty. or i delete
If Target.Cells.Value = " " Or IsEmpty(Target) Then Exit Sub 'Check if target cell is empty
With historyWks
nextRow = .Cells(.Rows.Count, "C").End(xlUp).Offset(0, 1).Row
End With
With historyWks
With .Cells(nextRow, "G")
.Value = Date
.NumberFormat = "mm/dd/yyyy"
End With
With .Cells(nextRow, "F")
.Value = Time
.NumberFormat = "h:mm:ss AM/PM"
End With
With .Cells(nextRow, "D")
.Value = Range("F1").Value 'pACKING OPERATOR
End With
With .Cells(nextRow, "H")
.Value = Range("D2").Value ' MODEL
End With
With .Cells(nextRow, "I")
.Value = Range("F2").Value ' wEIGHING OPERATOR
End With
End With
End If
End Sub