title: Why am I getting Run-time Error 424 Object Required?
body: <p>I am fairly new to VBA. I'm trying to write a program to run through large amounts of Part Numbers of various formats and categorize such part numbers, like so:</p>
  
  <pre><code>12A3-4
  1B-4
  2B-6
  A12B
  </code></pre>
  
  <p>And then have my program find all the formats of these types and return and count them, like so: (Note numbers are now represented by #)</p>
  
  <pre><code>    ##A# 1
      #B 2
      A##B 1
  </code></pre>
  
  <p>But I am getting a runtime error that I cannot seem to source.</p>
  
  <p>My program is as follows. There might be other errors.</p>
  
  <pre><code> Sub CheckPartNumbers()
  
  ' Select cell A2, where data begins
  Range("A2").Select
  ' Declare variable for cell location of our output
  Dim Cell As Range
  Set Cell = ActiveSheet.Range("C2")
  
  ' Set Do loop to stop when an empty cell is reached.
  Do Until IsEmpty(ActiveCell)
  ' Initialize vairable of type string to ""
  Dim partsFormat As String
  partsFormat = ""
  ' Run through each character of row
  For i = 1 To Len(ActiveCell.Value)
      Dim thisChar As String
      thisChar = Mid(ActiveCell.Value, i, 1)
      ' if thisChar is a letter
      If IsLetter(thisChar) Then
      partsFormat = partsFormat &amp; thisChar
      ' if thischar is a number
      ElseIf IsNumeric(thisChar) Then
      partsFormat = partsFormat &amp; "#"
      ' if dash
      ElseIf thisChar = "-" And (Len(ActiveCell.Value) - Len(Replace(ActiveCell.Value, "-", ""))) &gt; 1 Then
      partsFormat = partsFormat &amp; thisChar
      Else
      i = Len(ActiveCell.Value)
      End If
  Next i
  ' Check if partsFormat already exists in results with Match
  Dim myLocation As Range
  Set myLocation = Application.Match(partsFormat, Range("C2:D1"))
  ' If no, result will give error, so add partsFormat and make count 1
  If IsError(myLocation) Then
  Range(Cell) = partsFormat
  Range(Cell).Offset(0, 1) = 1
  Cell = Cell.Offset(1, 0)
  ' If yes, add 1 to appropriate cell
  Else
  myLocation.Offset(0, 1) = myLocation.Offset(0, 1).Value + 1
  End If
  
  ' Run through next row
  ActiveCell.Offset(1, 0).Select
  Loop
  
  End Sub
  </code></pre>
  
  <p>Any help is appreciated!</p>
  
  <p>EDIT:
  I had quite a few errors, so this chunk of my code is updated: </p>
  
  <pre><code>Dim myLocation As Variant 
  myLocation = Application.Match(partsFormat, Range("C1").EntireColumn) 
  ' If no, result will give error, so add partsFormat and make count 1 
  If IsError(myLocation) Then
  Cell = partsFormat
  Cell.Offset(0, 1) = 1
  Cell = Cell.Offset(1, 0) 
  ' If yes, add 1 to appropriate cell 
  Else 
  'myLocation.Offset(0, 1) = myLocation.Offset(0, 1).Value + 1 
  End If
  </code></pre>