Copy Range to another sheet in last open column

blimes

New Member
Joined
Jan 6, 2016
Messages
35
Office Version
  1. 2013
Platform
  1. Windows
I have a vba macro that runs and solves some thing that puts data in to Columns A:C which i then paste to sheet 2 in columns A:C. Now the macro returns to sheet one and keeps running and puts a different set of data in Columns A:C on Sheet1 how do i get this to automatically copy to the first blank column in Sheet2. It does this many times over which is why I'm looking to copy to the first blank column?

Thanks
Adam
 

Excel Facts

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)
Try something like this to copy Column 1 to 3 of Sheet1 to Columns on Sheet 2
This assumes you always have values in Row(1)

See Last Column
Code:
Sub Copy_Range()
'Modified 6/28/2018 12:20 AM  EDT
Application.ScreenUpdating = False
Dim i As Long
Dim Lastrow As Long
Dim Lastcolumn As Long
Lastrow = Cells(Rows.Count, "A").End(xlUp).Row
For i = 1 To 3
    Lastcolumn = Sheets(2).Cells(1, Columns.Count).End(xlToLeft).Column + 1
    Sheets(1).Columns(i).Copy Sheets(2).Columns(Lastcolumn)
Next
Application.ScreenUpdating = True
End Sub
 
Upvote 0

Forum statistics

Threads
1,223,992
Messages
6,175,822
Members
452,672
Latest member
missbanana

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