Error Checking in Excel
Thanks Thanks:  0
Likes Likes:  0
Page 1 of 2 12 LastLast
Results 1 to 10 of 11

Thread: importing data into a sheet

  1. #1
    Board Regular
    Join Date
    May 2002
    Posts
    50
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Is it possible to imoport data from a text file into an existing sheet. All I can find is file open and that creates a new sheet.

  2. #2
    Board Regular
    Join Date
    Mar 2002
    Location
    Cincinnati, Ohio, USA
    Posts
    6,824
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Sure...
    From the worksheet menu bar, choose Data, Get External Data, Import Text File.
    Pretty straight-forward.
    If you need any further assistance, repost.
    Tom

  3. #3
    Board Regular
    Join Date
    May 2002
    Posts
    50
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    I don't have the option to import text data. Only have run query option and when I try that 'query is not installed'.

  4. #4
    Board Regular
    Join Date
    Mar 2002
    Location
    Cincinnati, Ohio, USA
    Posts
    6,824
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Hi Joed.
    Maybe this is an installation option?
    If nobody can help you, we can write a macro which will do the import.
    Will wait and see...
    Tom

  5. #5
    Board Regular
    Join Date
    May 2002
    Posts
    50
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    I would like to use the macro option. That is what I am trying to do anyway.
    Currently I am using the opentext command. That opens a new sheet. What command would import into the current sheet?

    Thanks for the help.

  6. #6
    MrExcel MVP
    Join Date
    Feb 2002
    Location
    Austin, Texas USA
    Posts
    11,654
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    On 2002-05-10 13:00, TsTom wrote:
    Sure...
    From the worksheet menu bar, choose Data, Get External Data, Import Text File.
    Pretty straight-forward.
    If you need any further assistance, repost.
    Tom
    ...not available in XL97.

  7. #7
    MrExcel MVP
    Join Date
    Feb 2002
    Location
    Austin, Texas USA
    Posts
    11,654
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    On 2002-05-10 11:50, joed wrote:
    Is it possible to imoport data from a text file into an existing sheet. All I can find is file open and that creates a new sheet.
    What's the nature of your text file? Is it delimited? If so, by what? Is it a report or a data list?

  8. #8
    Board Regular
    Join Date
    May 2002
    Posts
    50
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    I should state I am using excel97. That's what we have in the office.
    The file is fixed length records of 200.
    Here is what I am currently using to open the file. 'Which' is the file name variable.

    Workbooks.OpenText Which, _
    Origin:=xlWindows, StartRow:=1, DataType:=xlFixedWidth, FieldInfo:= _
    Array(Array(0, 2), Array(10, 2), Array(34, 2), Array(42, 2), Array(54, 2), Array(57, 2), _
    Array(66, 2), Array(79, 2), Array(97, 2), Array(113, 1), Array(123, 2), Array(133, 2))

  9. #9
    Board Regular
    Join Date
    Apr 2002
    Location
    Greenwood, SC
    Posts
    677
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    I've had similar issues and have gone one of two ways.

    1. Open the file, move it to the current workbook, copy the data from the imported sheet to the existing sheet, then delete the old sheet. Set Application.ScreenUpdating = False while doing this and your users won't see all of the automation.

    2. Open the file directly through VB using the Open FileName For Input as #1 command and then loop through the data and put it into the correct cells of your worksheet.

    Either works fine and I doubt I could recommend one over the other. Personal preferences...

    Good luck,

    K

    P.S. One note if using the first method. Capture the name of your workbook into a variable first since you will need to use it to move the imported sheet. This is only really necessary if you ever rename the workbook.


    [ This Message was edited by: kkknie on 2002-05-13 10:52 ]

  10. #10
    Board Regular
    Join Date
    May 2002
    Posts
    50
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Both of those methods are beyond my knowledge base. I am trying to learn if you care to be more detailed.

Some videos you may like

User Tag List

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

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