title: Reading a barcode in excel to see if there is a match
body: <p>I am working with Excel 2016.  I have a smidgen of experience with VBA for applications, and some experience with programming.</p>
  
  <p>I'm trying to take input from a barcode scanner, compare it to a column in a spreadsheet, and if there's a match, put a few characters and a date stamp in some cells (Initials and date, each in separate columns).</p>
  
  <p><a href="https://stackoverflow.com/questions/27108954/excel-barcode-scanning-macro">This question</a> has a very similar use-case, and includes a code sample.  I have tried the code sample and can't get it to work.  At first, there was a problem with the array.  Eventually I figured out you could do "C2:C8" and that seemed to work, though that's not documented anywhere (Probably part of a basics course/class, but not findable).  There was an error about sub or function defined for <a href="https://support.office.com/en-us/article/MATCH-function-E8DFFD45-C762-47D6-BF89-533F4A37673A" rel="nofollow noreferrer">Match()</a>, so I enabled the <a href="https://stackoverflow.com/questions/21915646/excel-vba-compile-error-sub-of-function-not-defined#25986487">Solver</a> Add-in in the <a href="https://msdn.microsoft.com/en-us/library/office/ff196600.aspx" rel="nofollow noreferrer">security center</a>.  That didn't fix it, so I found this <a href="http://www.mrexcel.com/forum/excel-questions/397296-compile-error-sub-function-not-defined-3-line-macro.html" rel="nofollow noreferrer">forum post</a> that explained Match wasn't a VBA function.</p>
  
  <p>Now, I get an error after clicking the button "Run time error 1004, unable to get Match property of the WorksheetFunction class", clicking debug takes me to the same line.</p>
  
  <p>Here is the code I have wound up with:</p>
  
  <pre><code>Private Sub CommandButton1_Click()
  
  code = InputBox("Please scan a barcode and hit enter if you need to")
  matchedCell = Application.WorksheetFunction.Match(code, Range("C2:C8"), 0)
  matchedCell.Offset(0, 2) = Now
  
  End Sub
  </code></pre>
  
  <p>This is incredibly frustrating because I thought this was a simple thing and already solved.  Instead of working to solve the problem and build software, it seems I'm fighting syntax and/or the environment.  What am I doing wrong?</p>