My spreadsheet layout is: A col is where labels are scanned in, B col is where shipping labels are scanned in, C Col is where the autodate feeds into.
Individual labels are scanned in until the container is full then click over or arrow over to B col to scan in the shipping label at which point the autodate is filled in col C via VBA.
My issue is that if someone forgets to switch the active cell back over they start scanning in labels again and don't pay attention they end up with 4 or 5 labels in the wrong column so what they do is delete them then rescan them. The autodate will not delete for all the entries and i get a Run-time error '1004': Application defined or object defined error
As you can see i have a couple other things going on as well, unprotecting the sheet so the autodate can fill in a protected cell, as well as saving once a cell in col C has been filled, then reprotecting the sheet after all everything is completed.
As i think about it as i type could this protecting/unprotecting be my issue?
I have no issue with the autodate feeding in nor do i have an issue with deleting 1 cell in col B, its only when i delete multiples in col B that it wont clear all the date stamps in C and throws the error up
Basic knowledge here so please explain your answer throughly
Individual labels are scanned in until the container is full then click over or arrow over to B col to scan in the shipping label at which point the autodate is filled in col C via VBA.
My issue is that if someone forgets to switch the active cell back over they start scanning in labels again and don't pay attention they end up with 4 or 5 labels in the wrong column so what they do is delete them then rescan them. The autodate will not delete for all the entries and i get a Run-time error '1004': Application defined or object defined error
VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)
' Auto Date
ActiveSheet.Unprotect
Dim Cell As Range
For Each Cell In Target
If Cell.Column = Range("B:B").Column Then
If Cell.Value <> "" Then
Cells(Cell.Row, "C").Value = Now
Else
Cells(Cell.Row, "C").Value = ""
End If
End If
If Cells(Cell.Row, "C").Value <> "" Then
ActiveWorkbook.Save
End If
Next Cell
ActiveSheet.Protect
End Sub
As you can see i have a couple other things going on as well, unprotecting the sheet so the autodate can fill in a protected cell, as well as saving once a cell in col C has been filled, then reprotecting the sheet after all everything is completed.
As i think about it as i type could this protecting/unprotecting be my issue?
I have no issue with the autodate feeding in nor do i have an issue with deleting 1 cell in col B, its only when i delete multiples in col B that it wont clear all the date stamps in C and throws the error up
Basic knowledge here so please explain your answer throughly