YasserKhalil
07-20-2017, 06:11 AM
Hello everyone
I have devised that code that enables me to transfer data from adjacent cells to non-adjacent cells
Sub Test()
Dim a As Variant
Dim b As Variant
Dim i As Long
Dim x As Long
a = Range("H12:H16").Value
ReDim b(1 To UBound(a, 1) * 2, 1 To UBound(a, 2))
For i = LBound(b, 1) To UBound(b, 1) Step 2
x = x + 1
b(i, 1) = a(x, 1)
Next i
Range("N12").Resize(UBound(b, 1), UBound(b, 2)).Value = b
End Sub
Is there a simpler way to achieve that?
I have devised that code that enables me to transfer data from adjacent cells to non-adjacent cells
Sub Test()
Dim a As Variant
Dim b As Variant
Dim i As Long
Dim x As Long
a = Range("H12:H16").Value
ReDim b(1 To UBound(a, 1) * 2, 1 To UBound(a, 2))
For i = LBound(b, 1) To UBound(b, 1) Step 2
x = x + 1
b(i, 1) = a(x, 1)
Next i
Range("N12").Resize(UBound(b, 1), UBound(b, 2)).Value = b
End Sub
Is there a simpler way to achieve that?