title: VBA Split Cells and paste only specific cells
body: <p>updated*</p>
  
  <p>im new to VBA so help would be appreciated</p>
  
  <p>i have a sheet where i have in column A content in this structure:</p>
  
  <p>A1: Columnheader
  A2:  044000   randomwordx (3 spaces between number and randomwords)<br>
  A3:  056789   randomwordy (3 spaces between number and randomwords)
  A4: </p>
  
  <p>A5: a.) randomwords<br>
  A6: 3.randomwords
  A7:     </p>
  
  <p>A8: 600000   randomwordz (3 spaces between number and randomwords)<br>
  A9: 654124   randomwords (3 spaces between number and randomwords)  </p>
  
  <p>the delimiter between numbers and randomwords in column A is always 3x spaces</p>
  
  <p>what i want to do is the following: </p>
  
  <p>Go to Column A - select all cells which start with a 6-figures number</p>
  
  <ul>
  <li><p>split these cells and paste them into column C and D</p></li>
  <li><p>column C should contain only the starting number, remove any leading zeroes (if cell A2 has for example 044000, cell C2 should be 44000) </p></li>
  <li><p>column D should only contain the text which comes after the starting number of column A (in this example D2 should be "randomwordx" </p></li>
  <li><p>cells in column A which are blank or dont start with a 6 figure number should NOT be pasted in column C and D (in this example A4,A5,A6,A7 should NOT be pasted into C and D column)</p></li>
  </ul>
  
  <p>So it should look like this</p>
  
  <p>Column C:
  C1: Columnheader</p>
  
  <p>C2:44000</p>
  
  <p>C3:56789</p>
  
  <p>C4:60000</p>
  
  <p>C5:653124</p>
  
  <p>Column D:</p>
  
  <p>D1: Columnheader</p>
  
  <p>D2:randomwordx</p>
  
  <p>D3:randomwordy</p>
  
  <p>D4:randomwordz</p>
  
  <p>D5:randomwords</p>
  
  <p>I managed only to get this far, so help would be appreciated</p>
  
  <pre><code>Option Explicit
  
  Sub Splitcolumn() 
  Dim mrg As Range
  Dim LastRow As Long
  Dim r As Range
  Dim splitted() As String
  
  With Sheets("test")
      Set mrg = Sheets("test").Range("A4:A" &amp; LastRow)
      For Each r In mrg 
          splitted = Split(r.Value, "   ") 
          r.Value = splitted(0)
          r.Offset(2, 3).Value = splitted(1) &amp; "   " &amp; splitted(2)
      Next r
  End With
  End Sub
  </code></pre>
  
  <p>i received runtime error 1004</p>
  
  <p>thanks for your help</p>