Hi everyone,
Can someone please help,
So I have been using this stack up VBA code for the past a few months and everything seemed to work fine. Today, when I tried it, it left gap. So the idea here is to stack up multiple columns into a single column. The issue is that the code misses the first cell of the second column when stacking up and leaves an empty cell instead of the first value (first cell of column G:G.)
Can someone please help,
So I have been using this stack up VBA code for the past a few months and everything seemed to work fine. Today, when I tried it, it left gap. So the idea here is to stack up multiple columns into a single column. The issue is that the code misses the first cell of the second column when stacking up and leaves an empty cell instead of the first value (first cell of column G:G.)
Code:
Sub StackUp()
Application.ScreenUpdating = False
Dim i As Long
Dim Lastrow As Long
Dim Lastrowa As Long
For i = 1 To 12
Lastrow = Cells(Rows.Count, Choose(i, "C", "G", "K", "O", "S", "W", "AA", "AE", "AI", "AM", "AQ", "AU")).End(xlUp).Row + 1
If i = 1 Then
Lastrowa = 2
Else
Lastrowa = Cells(Rows.Count, "AY").End(xlUp).Row 'mod
End If
Range(Cells(2, Choose(i, "C", "G", "K", "O", "S", "W", "AA", "AE", "AI", "AM", "AQ", "AU")), Cells(Lastrow, Choose(i, "C", "G", "K", "O", "S", "W", "AA", "AE", "AI", "AM", "AQ", "AU"))).Copy Cells(Lastrowa + 1, "AY")
Next
Application.ScreenUpdating = True
End Sub