+ Reply to Thread
Results 1 to 4 of 4

load CSV files as worksheets from a list in cells

  1. #1
    Registered User
    Join Date
    02-12-2012
    Location
    Victoria
    MS-Off Ver
    Excel 2010, Excel 2013/64
    Posts
    23

    load CSV files as worksheets from a list in cells

    Hi all,

    I have a Macro from another source that searches through a directory tree for particular files, and enters the filenames of the files and directories in cells in a worksheet which I'm using as an Index.

    Using that list, I want to load the CSV files as worksheets in the workbook, iteratively going through the rows, and using alphanumerical text from cells in the same row as worksheet names.

    The sort of worksheet I'm working from is attached.

    Col
    A directory
    B filename
    C dataset name
    D analysis type

    I'd like the name of the worksheet to be
    Please Login or Register  to view this content.
    The full path and file location is
    Please Login or Register  to view this content.
    because the path values in Column A have no trailing "\".

    The number of rows is always variable, so it needs to be some sort of For Each loop I think.. but I'm not sure where to start because I'm not sure how to reference the different cells for sheet names as rows are traversed.

    any help would be wonderful.
    Attached Files Attached Files

  2. #2
    Valued Forum Contributor
    Join Date
    05-21-2009
    Location
    Great Britain
    MS-Off Ver
    Excel 2003
    Posts
    550

    Re: load CSV files as worksheets from a list in cells

    Try this (I didn't look at your workbook):
    Please Login or Register  to view this content.
    Post responsibly. Search for excelforum.com

  3. #3
    Registered User
    Join Date
    02-12-2012
    Location
    Victoria
    MS-Off Ver
    Excel 2010, Excel 2013/64
    Posts
    23

    Re: load CSV files as worksheets from a list in cells

    Thanks kindly for helping Chippy.

    This is a good start, but it throws an error: "Copy method of Worksheet class failed"
    and the macro is also opening the worksheets to new workbook(s) [hard to tell, because it dies on the first one]. I'd like the csv spreadsheets to be imported into the open workbook as additional sheets.

    List is in range is A1:A and the sheet name should be drawn from Columns C&D.

    Modified here, but still has the above issue.

    Please Login or Register  to view this content.

  4. #4
    Registered User
    Join Date
    02-12-2012
    Location
    Victoria
    MS-Off Ver
    Excel 2010, Excel 2013/64
    Posts
    23

    Re: load CSV files as worksheets from a list in cells

    OK it's working, thanks for your help Chippy.

    With a little help from this post in this forum, I got it working.

    Please Login or Register  to view this content.
    This now does it into the same workbook.

    cheers.. solved.

+ 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