title: VBA- Cell is a number then copy it
body: <p>I have in E, F and I columns something written. In E and F its a name and in I its a number. In I column there are some cells with number and rest are blank. When ever its a number, I should copy the names from E1, F1 and copy it to C3 and D3 respectively. I have written a code but its not functioning properly. Could you please help me.</p>
  <pre><code>Option Explicit
  
  Sub copy()
      Dim cell As Long
      Dim nr As Integer
      Dim rng As range
      Dim i As Long
  
      range(&quot;G1:G15&quot;).Select
      Selection.CurrentRegion.Select
      nr = Selection.Rows.Count
      For i = 2 To nr
          'test if cell is empty
          If ActiveCell(i, 7) = &quot;&quot; Then
              'write to adjacent cell
              ActiveCell = ActiveCell + 1
          Else
              ActiveCell.Offset(-3, -2).Value.copy ActiveCell.Offset(-3, 0)
          End If
      Next i
  End Sub
  </code></pre>