+ Reply to Thread
Results 1 to 6 of 6

Merge different Excel/CSV files into one with variable in path name

  1. #1
    Registered User
    Join Date
    03-13-2013
    Location
    TBA
    MS-Off Ver
    Excel 2007
    Posts
    4

    Merge different Excel/CSV files into one with variable in path name

    Helllo,
    I have a macro for mergeing multiple excel files into one excel file with multiple tabs. But the path (highlighted in blue) from where the macro is picking up the files in fixed. Is there any way that macro will prompt to select the path/folder instead of fixed path in micro?

    I found a thread on similar subject but the path in given macro was again fixed.

    My micro is as below.

    Sub Multiple_Sheets_to_One()
    Path = "D:\Excel Training\Excel Combiner"
    Filename = Dir(Path & "*.csv")
    Do While Filename <> ""
    Workbooks.Open Filename:=Path & Filename, ReadOnly:=True
    For Each Sheet In ActiveWorkbook.Sheets
    Sheet.Copy After:=ThisWorkbook.Sheets(1)
    Next Sheet
    Workbooks(Filename).Close
    Filename = Dir()
    Loop
    End Sub
    "


    Appreciate your help !!!

    Thanks,
    Nik.
    Last edited by nikats; 03-28-2013 at 06:13 AM.

  2. #2
    Registered User
    Join Date
    03-13-2013
    Location
    TBA
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: Merge different Excel/CSV files into one with variable in path name

    Please help !!

  3. #3
    Registered User
    Join Date
    03-13-2013
    Location
    TBA
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: Merge different Excel/CSV files into one with variable in path name

    Please help... I am using this macro daily for different locations & it is difficult to change it in macro....so if i'll have an option to choose location for this macro, will make things easier..

  4. #4
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Merge different Excel/CSV files into one with variable in path name

    Please use code tags with your code as per forum's rule.
    Try this one

    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    03-13-2013
    Location
    TBA
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: Merge different Excel/CSV files into one with variable in path name

    Thanks a lot for the help!!!

  6. #6
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,525

    Re: Merge different Excel/CSV files into one with variable in path name

    Quote Originally Posted by nikats View Post
    I found a thread on similar subject but the path in given macro was again fixed.
    Select folder should be
    Please Login or Register  to view this content.

+ 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