Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default copying data from text file to excel sheet


hi

i want to copy data from text file to excel sheet

for ex

the data int the text file is

1 0 1 0 1
0 1 0 1 0
1 0 1 0 1

we have get this data into excel sheet like this

A B C D E
1 1 0 1 0 1
2 0 1 0 1 0
3 1 0 1 0 1
4
5


So,Plz help me regarding this

thanks
sree


--
sreedhar
------------------------------------------------------------------------
sreedhar's Profile: http://www.excelforum.com/member.php...o&userid=27582
View this thread: http://www.excelforum.com/showthread...hreadid=476716

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default copying data from text file to excel sheet

turn on the macro recorder and then do file=OPen and select your file. go
through the text import wizard and select delimited and space as the
delimiter (or tab - whatever is appropriate).

Then, when the file is in, turn off the macro recorder.

This gives you the basic code you need.

If you want it in an existing sheet, then just use additional code like

Activesheet.UsedRange.copy Destination:= _
ThisWorkbook.worksheets(1).Range("A1")
ActiveWorkbook.Close Savechanges:=False

You can also modify the code to allow you to select a file by using

fName = Application.GetOpenfileName

then replacing the hard coded filename in the recorded code with fname

--
Regards,
Tom Ogilvy

"sreedhar" wrote in
message ...

hi

i want to copy data from text file to excel sheet

for ex

the data int the text file is

1 0 1 0 1
0 1 0 1 0
1 0 1 0 1

we have get this data into excel sheet like this

A B C D E
1 1 0 1 0 1
2 0 1 0 1 0
3 1 0 1 0 1
4
5


So,Plz help me regarding this

thanks
sree


--
sreedhar
------------------------------------------------------------------------
sreedhar's Profile:

http://www.excelforum.com/member.php...o&userid=27582
View this thread: http://www.excelforum.com/showthread...hreadid=476716



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
Split text file into Excel sheet and separate the final results intoa new sheet Luciano Paulino da Silva Excel Worksheet Functions 8 April 18th 09 02:00 AM
Copying only required string from txt file to excel sheet sangram Excel Discussion (Misc queries) 1 February 24th 09 11:47 AM
Stop excel from copying data from one sheet to another Imajica New Users to Excel 1 November 3rd 06 06:53 PM
Copying rows with spesified data on one or more columns from sheet/file to another? Zemalf Excel Programming 0 October 15th 04 07:55 AM


All times are GMT +1. The time now is 03:12 AM.

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"