title: Shell sort column
body: <p>I'm learning VB all by myself. I got to write code to sort column A:A in Shell method.
  I'm stuck on proceeding to next gap (next gap is simply gap/2) after sorting for first N/2 (N is number of cells to sort).</p>
  
  <pre><code>Sub Shellsort()
  
  Dim gap As Long
  Dim i As Long
  Dim Obad As Range
  Dim N As Long
  Dim temp As Long
  
  N = Application.WorksheetFunction.CountA(Sheets(1).Range("A:A"))
  
  gap = N
  
  
      For i = 1 To gap
  
          If Cells(i, 1).Value &lt; Cells(i + gap, 1).Value Then
  
              temp = Cells(i, 1).Value
              Cells(i, 1).Value = Cells(i + gap, 1).Value
              Cells(i + gap, 1).Value = temp
  
          End If
  
      Next i
  
  
  End Sub
  </code></pre>
  
  <p>How should I continue? This code ofc now compares only 2 cells, but I have no idea how make it depend on actual gap.</p>