VBA Code Paste in Next empty Cell

P_85

New Member
Joined
May 23, 2011
Messages
4
Hello,

I am trying to create a macro to cut and paste data from several columns and paste it into the next empty cell in Column A.

There are 10 columns on the worksheet. I would like to cut all the data from the 10 columns and paste it all into Column A. The headers for these columns are the same (ProductID). The worksheet I am working on is called Archive

I am totally stuck on how to do this. Any help would be greatly appreciated.

Many Thanks
 

Excel Facts

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).
Hi
Welcome to board .

try Vog's Code for the same


Code:
Sub ayaz2()
Dim LR1 As Long, LR2 As Long, i As Integer, LC As Integer
LC = Cells(1, Columns.Count).End(xlToLeft).Column
Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual
For i = 2 To LC
    LR1 = Cells(Rows.Count, 1).End(xlUp).Row
    LR2 = Cells(Rows.Count, i).End(xlUp).Row
    Range(Cells(2, i), Cells(LR2, i)).Copy Destination:=Cells(LR1 + 1, 1)
Next i
Application.CutCopyMode = False
Range(Cells(1, 2), Cells(Rows.Count, LC)).Delete
Application.ScreenUpdating = True
Application.Calculation = xlCalculationSemiautomatic
End Sub
 
Upvote 0

Forum statistics

Threads
1,214,652
Messages
6,120,747
Members
448,989
Latest member
mariah3

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top