ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   appending data from an external text file (https://www.excelbanter.com/excel-programming/284302-appending-data-external-text-file.html)

clui[_7_]

appending data from an external text file
 

I'm tyring to append data from an external tab-delimited text file to a
worksheet named "all" in the active workbook. I only need the data
from Row 2 and above (whatever the last row is) from the external text
file. How do I code it? Thanks a lot!!


------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~View and post usenet messages directly from http://www.ExcelForum.com/

~~Now Available: Financial Statements.xls, a step by step guide to creating financial statements

Bill Manville

appending data from an external text file
 
Clui wrote:
I'm tyring to append data from an external tab-delimited text file to a
worksheet named "all" in the active workbook. I only need the data
from Row 2 and above (whatever the last row is) from the external text
file. How do I code it? Thanks a lot!!


Record yourself opening the text file and insert that code at '****

Dim WB As Workbook
Set WB = ActiveWorkbook
'****
Range("A1").CurrentRegion.Offset(1).Copy destination:= _
WB.Sheets("All").Cells(Rows.Count, "A").End(xlUp).Offset(1)
ActiveWorkbook.Close False

Bill Manville
MVP - Microsoft Excel, Oxford, England
No email replies please - reply in newsgroup



All times are GMT +1. The time now is 12:06 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com