title: Error with copy paste due to merged column cells
body: <p>I want to copy paste values from 4 columns in one worksheet into 4 columns of another worksheet depending on whether the values in a single column are null or not.</p>
  <p>Following is my code:</p>
  <pre><code>Private Sub CommandButton1_Click()
      
  Dim lastrow As Long, erow As Long
  
  lastrow = Worksheets(&quot;jun&quot;).Cells(Rows.Count, 1).End(xlUp).Row
  erow = 20
  
  For i = 8 To lastrow
      If Worksheets(&quot;jun&quot;).Cells(i, 16).Value &lt;&gt; &quot;&quot; Then
          Worksheets(&quot;jun&quot;).Cells(i, 16).Copy
          Worksheets(&quot;jun&quot;).Paste Destination:=Worksheets(&quot;test&quot;).Cells(erow + 1, 1)
          Worksheets(&quot;jun&quot;).Cells(i, 3).Copy
          Worksheets(&quot;jun&quot;).Paste Destination:=Worksheets(&quot;test&quot;).Cells(erow + 1, 2)
          Worksheets(&quot;jun&quot;).Cells(i, 2).Copy
          Worksheets(&quot;jun&quot;).Paste Destination:=Worksheets(&quot;test&quot;).Cells(erow + 1, 3)
          Worksheets(&quot;jun&quot;).Cells(i, 6).Copy
          Worksheets(&quot;jun&quot;).Paste Destination:=Worksheets(&quot;test&quot;).Cells(erow + 1, 4)
          erow = erow + 1
      End If
  Next i
  
  End Sub
  </code></pre>
  <p>However this code produces an error when I try to paste the values into the second column of the test worksheet and I suspect this is because it is made of a merged column.</p>
  <p>Following is the picture that shows the merged column. How could I combat this issue?
  <a href="https://i.stack.imgur.com/3w1t3.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/3w1t3.png" alt="enter image description here" /></a></p>