You are here:

Excel/VB Copy Range with Lastrow to new workbook


Hi Tom,

Don't know if you have time or not but I was wondering if you could help with the following query;

I need to copy a range, "I3" to lastrow to a new workbook. The workbook name containing the values will change.

The range I:3 to say I:16000 then needs to be pasted as values and saved as a txt and should default into "C:\Documents and Settings\ etc.

I have seen numerous bits of code but can't seem to put it together to perform this task.

Any help would be really appreciated

Many thanks for you time


I have no way to determine what the name of your destination workbook is so I will give you an example with a known name.  

Sub ABC()
Dim bk as workbook, sh as worksheet
set bk = workbooks("MyBooks.xlsx")
set sh = bk.worksheets("Sheet1")
Activesheet.Range("I3:I6000").copy sh.Cells(sh.rows.count,"A").End(xlup).Offset(1,0)
bk.SaveAs "C:\Documents and Settings\MyNewBook.txt Fileformat:=xlTextWindows
bk.close Savechanges:=False
End Sub

perhaps that will help you put it together.  I assume the destination workbook has only a single sheet in it.

When you run the macro it assumes the activesheet is the sheet that has the data in I3:I6000

Tom Ogilvy

About Excel
This topic answers questions related to Microsoft Excel spreadsheet (or workbook) stand-alone or Mircrosoft Office Excel including Excel 2003, Excel 2007, Office 2000, and Office XP. You can get Excel help on Excel formulas(or functions), Excell macros, charting in Excel, advanced features, and the general use of Excel. This does not provide a general Excel tutorial nor the basics of using a spreadsheet. It provides specific answers to using Microsoft Excel only. If you do not see your Excel question answered in this area then please ask an Excel question here


All Answers

Answers by Expert:

Ask Experts


Tom Ogilvy


Selected as an Excel MVP by Microsoft since 1999. Answering Excel questions in Allexperts since its inception in 2001. Able to answer questions on almost all aspects of Excel's internal capabilities. If seeking a VBA solution, please specify that in your question itself so I give you the answer you want. [Excel has weak protection - if you are distributing an application, I don't answer questions on how to protect your project from your users.]


Extensive experience.

Master of Science (MS) degree Operations Research (ORSA)

Awards and Honors
Microsoft MVP in Excel.

©2016 All rights reserved.