Copy column data from one workbook to next empty column in another

daverunt

Well-known Member
Joined
Jul 9, 2009
Messages
1,946
Office Version
  1. 2013
Platform
  1. Windows
Hi,

I am just starting a new macro and I am trying to copy a single column of data from a folder of csv files (ResultFile) into the first empty column in a newly created workbook RptTemplate.
I wanted to use the format 'Copy Destination:-' inside a loop to do this.

Is there a one liner that can do it or will I need to find the last column and use that method?

Code:
Set RptTemplate = Workbooks.Add
Sheets("Sheet1").Name = "Report"
   
 'Add the data sheet.
Sheets.Add(After:=Sheets(Sheets.Count)).Name = "Data"
   

'''''''''''''''There will be a loop here to go through several csv files

'Open the csv Result File and copy column B5 down into RptTemplate to next empty column

Workbooks.Open ResultFile
Set CSVFile = ActiveWorkbook
       
     
 Range("B5", Range("B5").End(xlDown)).Copy Destination:=RptTemplate.Sheets("Data").Range("A2")  '-----------------------  to first empty column

 ''''''''''''end loop
 

Excel Facts

How can you turn a range sideways?
Copy the range. Select a blank cell. Right-click, Paste Special, then choose Transpose.

Forum statistics

Threads
1,214,825
Messages
6,121,787
Members
449,049
Latest member
greyangel23

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