I'm setting up a mini program so an operator scans a barcode, it creates one in excel and prints it on a label printer.
I need it to automatically print as soon as he's scanned in the 10 digit code.
What I have so far is -
Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)
If Len(Sheet1!A2) = 10 Then
ActiveWorkbook.PrintOut Copies:=1, Collate:=True, IgnorePrintAreas:=False
Sheets("Sheet1").Range("A2").ClearContents
End If
End Sub
This doesn't appear to work though. I have this code in Sheet1. The error message I get is
Run-time error '438' Object doesn't support this property or method
It highlights the If Len bit as the issue.
Can anyone help please?