Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Importing text file into an existing excel workbook.

I was wondering if it was possible to get a text file and
import it into an excel worksheet that already exist. For
example, I have an excel worksheet that has Headings and a
fixed format of where I key in data. I want to import a
text file that has the data that I key in everyday into
these columns. Is there a quick way of doing this or do I
have to write lots of code for this?
Thanks to whomever can help.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Importing text file into an existing excel workbook.

with this code in your workbook where you key in data and the sheet where
you key in the data active, run:

Sub GetData()
Dim rng as Range, wkbk as Workbook
set rng = cells(rows.count,1).End(xlup)(2)
set wkbk = workbooks.Open(Filename:="C:\Myfolder\mytextfile.t xt")
wkbk.worksheets(1).Range("A1").CurrentRegion.Copy _
Destination:=rng
wkbk.close savechanges:=false
End Sub

--
Regards,
Tom Ogilvy

"Juan Melero" wrote in message
...
I was wondering if it was possible to get a text file and
import it into an excel worksheet that already exist. For
example, I have an excel worksheet that has Headings and a
fixed format of where I key in data. I want to import a
text file that has the data that I key in everyday into
these columns. Is there a quick way of doing this or do I
have to write lots of code for this?
Thanks to whomever can help.



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Importing text file into an existing excel workbook.

Is there a way of rearranging the data in the file to go
into different parts of the spreadsheet. Say for example
I have the following text file.
Store #
01008
01009
01010

I want to put this on the spreadsheet as :

A1 B1 B2 B3
Store # 01008 01009 01010
Is this possible? Really appreciate your quick response.
Thanks.
-----Original Message-----
with this code in your workbook where you key in data and

the sheet where
you key in the data active, run:

Sub GetData()
Dim rng as Range, wkbk as Workbook
set rng = cells(rows.count,1).End(xlup)(2)
set wkbk = workbooks.Open

(Filename:="C:\Myfolder\mytextfile.txt")
wkbk.worksheets(1).Range("A1").CurrentRegion.Co py _
Destination:=rng
wkbk.close savechanges:=false
End Sub

--
Regards,
Tom Ogilvy

"Juan Melero" wrote

in message
...
I was wondering if it was possible to get a text file

and
import it into an excel worksheet that already exist.

For
example, I have an excel worksheet that has Headings

and a
fixed format of where I key in data. I want to import a
text file that has the data that I key in everyday into
these columns. Is there a quick way of doing this or

do I
have to write lots of code for this?
Thanks to whomever can help.



.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Importing text file into an existing excel workbook.

Sub GetData()
Dim rng as Range, wkbk as Workbook
set rng = cells(rows.count,1).End(xlup)(2)
set wkbk = workbooks.Open(Filename:="C:\Myfolder\mytextfile.t xt")
wkbk.worksheets(1).Range("A1").CurrentRegion.Colum ns(1).Copy
rng.PasteSpecial paste:=xlPasteAll, Transpose:=True
wkbk.close savechanges:=false
End Sub

--
Regards,
Tom Ogilvy


Juan Melero wrote in message
...
Is there a way of rearranging the data in the file to go
into different parts of the spreadsheet. Say for example
I have the following text file.
Store #
01008
01009
01010

I want to put this on the spreadsheet as :

A1 B1 B2 B3
Store # 01008 01009 01010
Is this possible? Really appreciate your quick response.
Thanks.
-----Original Message-----
with this code in your workbook where you key in data and

the sheet where
you key in the data active, run:

Sub GetData()
Dim rng as Range, wkbk as Workbook
set rng = cells(rows.count,1).End(xlup)(2)
set wkbk = workbooks.Open

(Filename:="C:\Myfolder\mytextfile.txt")
wkbk.worksheets(1).Range("A1").CurrentRegion.Co py _
Destination:=rng
wkbk.close savechanges:=false
End Sub

--
Regards,
Tom Ogilvy

"Juan Melero" wrote

in message
...
I was wondering if it was possible to get a text file

and
import it into an excel worksheet that already exist.

For
example, I have an excel worksheet that has Headings

and a
fixed format of where I key in data. I want to import a
text file that has the data that I key in everyday into
these columns. Is there a quick way of doing this or

do I
have to write lots of code for this?
Thanks to whomever can help.



.



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Importing data from a DataCom file into an Excel workbook Stefaans Excel Discussion (Misc queries) 0 October 3rd 08 12:19 PM
importing text file to excel sherry Excel Discussion (Misc queries) 1 February 20th 08 08:17 PM
Importing text file, only option to edit existing file smokey99 Excel Discussion (Misc queries) 8 April 26th 06 09:08 PM
importing text file in excel UT Excel Discussion (Misc queries) 0 March 16th 06 10:20 PM
Importing data into an existing workbook Bob Reynolds Excel Worksheet Functions 2 April 15th 05 03:43 PM


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

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"