Copy Range to another sheet in last open column

blimes

New Member
Joined
Jan 6, 2016
Messages
32
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

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.
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,215,239
Messages
6,123,818
Members
449,127
Latest member
Cyko

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