title: How can I check if the Length is less than 2 in VBA
body: <p>I have two dashes in my cell, I am trying to check after second dashes how many characters. If the length or character more than two then delete the row.</p>
  
  <pre><code>   Sub fi()
  
     Dim lastrow As Long, i As Long, firstD As Integer, secondD As Integer, bpno As Long
  
     lastrow = ActiveSheet.UsedRange.Rows.Count
         For i = 1 To lastrow
            firstD = InStr(1, ActiveSheet.Cells(i, 1), "-")
            secondD = InStr(firstD + 1, ActiveSheet.Cells(i, 1), "-")
            bpno = Mid(ActiveSheet.Cells(i, 1), firstD + 1, secondD - firstD)
  
              If Len(bpno) &gt; 1 Then
                MsgBox ("yes")
              End If
  
         Next i
  
  
  End Sub
  </code></pre>