+ Reply to Thread
Results 1 to 2 of 2

copying data from text file to excel sheet

  1. #1
    Registered User
    Join Date
    09-27-2005
    Posts
    16

    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

  2. #2
    Tom Ogilvy
    Guest

    Re: 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" <[email protected]> wrote in
    message news:[email protected]...
    >
    > 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 to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1