I'm not even sure, the message just pops up, I hit OK, and I'm not taken to the code.
Here is my entire code for that sheet, as it was before adding yours:
Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)
Dim rngCell As Range
Dim rngMonitor As Range
On Error GoTo err_handle
'If 'Entry Page'!F7 changes:
If Not Intersect(Target, Me.Range("$F$7")) Is Nothing Then
Application.EnableEvents = False
Select Case Len(Trim(Target.Text))
Case 0: Sheets("Inspection Report").Range("L6, L86, L166").Value = ""
Sheets("Inspection Report").Range("C77, C157, C237").Value = ""
Case Is <= 21: Sheets("Inspection Report").Range("L6, L86, L166").Value = Target.Text
Sheets("Inspection Report").Range("C77, C157, C237").Value = ""
Case Else: Sheets("Inspection Report").Range("L6, L86, L166").Value = "See Notes"
Sheets("Inspection Report").Range("C77, C157, C237").Value = Target.Text
End Select
Application.EnableEvents = True
End If
If Target.Address = "$F$22" Then
If Target.Value > 0 Then Exit Sub
Application.EnableEvents = False
If Target.Value = "" Then MsgBox "You need to print at least 1 label!"
Target.Value = 1
Application.EnableEvents = True
End If
' adjust to whatever cells you want to monitor
Set rngMonitor = Range("C4")
If Not IsValidFileName(ThisWorkbook.Name) Then
MsgBox "Please save the file as <partnumber>Rev<revision number> before entering data!"
On Error Resume Next
With Application
.EnableEvents = False
.Undo
.EnableEvents = True
End With
Exit Sub
End If
If Not Intersect(Target, Range("C8,C12")) Is Nothing Then
MsgBox "Do not change the part number or revision number. Save the file as the relevant name and the numbers will change automatically."
On Error Resume Next
With Application
.EnableEvents = False
.Undo
.EnableEvents = True
End With
Exit Sub
End If
If Not Intersect(Target, rngMonitor) Is Nothing Then
With Application
.ScreenUpdating = False
.EnableEvents = False
End With
For Each rngCell In Intersect(Target, rngMonitor).Cells
If Val(rngCell.Text) > 0 Then
If Len(rngCell.Text) < 4 Then
rngCell.Value = Right("000" & rngCell.Text, 3) & "0"
ElseIf Len(rngCell.Text) > 4 Then
MsgBox "Entry is too long!"
rngCell.ClearContents
End If
End If
Next rngCell
End If
If Not Intersect(Target, Range("NameCells")) Is Nothing Then
For Each rngCell In Intersect(Target, Range("NameCells"))
UpdatePics rngCell.Offset(, -1).Name.Name, rngCell.Value
Next rngCell
End If
clean_up:
With Application
.EnableEvents = True
.ScreenUpdating = True
End With
Exit Sub
err_handle:
MsgBox Err.Description
Resume clean_up
End Sub
Bookmarks