title: Using Microsoft Excel VBA to extract phone numbers
body: <p>I am trying to extract phone numbers from Columns A:E, and place them in Columns F:I. <em>"The provided example is an instance on Col"E""</em>. </p>
  
  <p>I would like the phone numbers extracted to Columns F:I. However, if a column already has data. Then move onto the next, using that last "I" Column as the final location should the data have 4 numbers <em>"It will never be greater than 4"</em></p>
  
  <pre><code>Dim c As Range, i As Integer
  For Each c In Worksheets("data").Range("B2", _
  Worksheets("data").Range("B" &amp; Rows.Count).End(xlUp))
  With c
    If .Value2 Like "*???-???-????*" Then
      For i = 11 To 14
        If .Offset(, i).Value2 = "" Then
          .Offset(, i).Value2 = .Value2
          .Value2 = ""
          GoTo NextC
        End If
      Next i
    End If
  End With
  NextC:
    Next c
  End sub
  </code></pre>
  
  <p>The problem I am having is it only returns some of the phone numbers and not all of them. <em>"98k rows"</em></p>
  
  <p>The data is from an old XML file that I extracted. On a specific "Name" column from the extraction, I had replaced the carriage return code with a unique symbol, I then used that unique symbol to run a text to columns. It provided key "Name" data from A:N. {example: Customer names, email address, cell phones, home phone, item details, street address, city, zip...} Now each one of those columns could very well hold phone number data that I would like extracted in 4 separate columns "most likley F:I", but also keeping the logic that as the phone columns fill up, it doesnt overwrite and moves on to the next available column from the 4 I designated.</p>
  
  <p>changed
      <code>If .Value2 Like "*???-???-????*" Then</code>
  to
      <code>If .text Like "*###-###-####*" Then</code></p>
  
  <p>Success.</p>