title: Loop is mistakenly pasting over columns with data
body: <p>The code at the bottom copies columns individually from one sheet to another and performs text to columns one by one. for example, after column A has been taken care of, the Text to columns procedure for column B (first sheet) is supposed to begin in the next available empty column in the second sheet. </p>
  
  <p>The rows in the first sheet are of different lengths. So column A might have cells A1:A25 full but column N might only have some of its cells full because some of the rows have ended.</p>
  
  <p>This code works fine until it encounters the first partially full column and then it keeps pasting columns into the same column.</p>
  
  <p>I thought the line below would take care of this but it doesn't seem to work:</p>
  
  <pre><code>If Application.WorksheetFunction.CountA(Excel.Sheets("Organise_R").Columns(b)) &gt; 0  Then b = b + 1
  </code></pre>
  
  <p>I've been trying for the last few hours but I've had no success.Any help would be much appreciated! Thanks in advance!</p>
  
  <pre><code>For a = 1 To 60
  
  'If Excel.WorksheetFunction.CountBlank(Excel.Sheets("Import_R").Columns(a)) &lt; 1048576
  If Application.WorksheetFunction.CountA(Excel.Sheets("Import_R").Columns(a)) &gt; 0 Then
  
      Excel.Sheets("Import_R").Columns(a).Copy
  
      b = Excel.Sheets("Organise_R").Cells(1, Columns.Count).End(Excel.xlToLeft).column
  
      Excel.Sheets("Organise_R").Select
  
      'If Cells(1, b) &lt;&gt; ""
      'If Excel.WorksheetFunction.CountBlank(Excel.Sheets("Organise_R").Columns(b)) &lt; 1048576 Then
      If Application.WorksheetFunction.CountA(Excel.Sheets("Organise_R").Columns(b)) &gt; 0 Then b = b + 1
  
  
          Excel.Sheets("Organise_R").Columns(b).EntireColumn.Select
          Excel.ActiveSheet.Paste
  
          Excel.Application.CutCopyMode = False
          Selection.TextToColumns Destination:=Cells(1, b), DataType:=xlDelimited, _
                  TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=True, Tab:=False, _
                  Semicolon:=False, Comma:=False, Space:=True, Other:=False, FieldInfo _
                  :=Array(Array(1, 1), Array(2, 1), Array(3, 1), Array(4, 1), Array(5, 1), Array(6, 1), _
                  Array(7, 1), Array(8, 1)), TrailingMinusNumbers:=True
  
  End If
  
  
  
  Next a
  </code></pre>