+ Reply to Thread
Results 1 to 2 of 2

Copying worksheets from multiple workbooks into current workbook

  1. #1
    Registered User
    Join Date
    04-02-2014
    Location
    sweden
    MS-Off Ver
    Excel 2010
    Posts
    2

    Copying worksheets from multiple workbooks into current workbook

    Hi i was wondering if anybody if you guys could help me out?

    Im trying to copy multiple workbooks and just save it into only one worksheet.
    I have 2000 diffrent workbooks with the diffrent amount of rows, The ammount of cells is the same and it dosent change.

    Im new with this kind of stuff so i'm thankfull for all help u can offer, i cant make it work so edit it how ever u want..
    i dont have any idé about what im doing so help me..
    im working on a excel 2010

    This is what i got for the moment..

    Sub LoopThroughDirectory()
    Dim MyFile As String
    Dim erow
    Dim Filepath As String
    Filepath = “C:\test\”
    MyFile = Dir("test\")

    Do While Len(MyFile) > 0
    If MyFile = "master.xlsm" Then
    Exit Sub
    End If


    Range(Range("a1"), ActiveCell.SpecialCells_(xlLastCell)).Select
    Selection.Name = "PivotData"


    Workbooks.Open (Filepath & MyFile)
    Range("A2:AD20").Copy
    ActiveWorkbook.Close

    erow = Sheet1.Cells(Rows.Count, 1).End(xlUp).Offset(1, 0).Row
    ActiveSheet.Paste Destination:=Worksheets("sheet1").Range(Cells(erow, 1), Cells(erow, 1))

    MyFile = Dir
    Loop
    End Sub

  2. #2
    Forum Expert Fotis1991's Avatar
    Join Date
    10-11-2011
    Location
    Athens(The homeland of the Democracy!). Greece
    MS-Off Ver
    Excel 1997!&2003 & 2007&2010
    Posts
    13,744

    Re: Copying worksheets from multiple workbooks into current workbook

    Welcome to the forum.

    Unfortunately

    Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code.

    Posting code between [CODE]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/CODE] tags makes your code much easier to read and copy for testing, it also maintains VBA formatting.

    Highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found here



    (This thread should receive no further responses until this moderation request is fulfilled, as per Forum Rule 7)
    Regards

    Fotis.

    -This is my Greek whisper to Europe.

    --Remember, saying thanks only takes a second or two. Click the little star * below, to give some Rep if you think an answer deserves it.

    Advanced Excel Techniques: http://excelxor.com/

    --KISS(Keep it simple Stupid)

    --Bring them back.

    ---See about Acropolis of Athens.

    --Visit Greece.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. copying similar named worksheets from multiple workbooks into a master workbook
    By bradpeh in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 10-24-2013, 04:41 AM
  2. [SOLVED] Runtime Error 1004 when Copying worksheets from multiple workbooks into current workbook
    By dharris42 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-27-2013, 11:56 AM
  3. [SOLVED] Copying Worksheets from Multiple Workbooks to a Single Workbook, Separate Worksheets
    By DHartwig35805 in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 08-27-2012, 11:38 AM
  4. Copying Worksheets from Multiple Workbooks to a Single Workbook, Separate Worksheets
    By Abhi_1977 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 08-27-2012, 11:32 AM
  5. Copying Multiple worksheets in Multiple workbooks to one single workbook
    By ebrabender in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 10-28-2011, 02:30 PM

Tags for this Thread

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