Its been a long time since i tried VB in excel and i followed this ladies tutorial on youtube (Use Barcodes in Excel to track in and outs - Barb Henderson, 2019 [Youtube]). I copied everything and adjusted it to fit my sheets but I don't know why this error keeps occurring on this line.
_______________________________________________________________________________
_______________________________________________________________________![]()
Sub checkin() Dim barcode As String Dim rng As Range Dim rownumber As Long barcode = Worksheet("Sheet4").Cells(1, 2) Set rng = Sheet1.Columns("a:a").Find(What:=barcode, _ LookIn:=xlFormulas, LookAt:=xlWhole, SearchOrder:=xlByRows, _ SearchDirection:=xlNext, MatchCase:=False, SearchFormat:=False) If rng Is Nothing Then ActiveSheet.Columns("a:a").Find("").Select ActiveCell.Value = barcode ActiveCell.Offset(0, 1).Select ActiveCell.Value = Date & " " & Time ActiveCell.NumberFormat = "d/m/yyyy h:mm AM/PM" Worksheets("Sheet4").Cells(1, 2) = "" End If End Sub ________
The error I am getting is "Compile error: Sub or Function not defined" It then highlights the word Worksheet in the yellow line.
image_2021-12-28_032933.png
Bookmarks