+ Reply to Thread
Results 1 to 18 of 18

Macro copy data from multiple workbooks to master

Hybrid View

pram Macro copy data from multiple... 02-28-2013, 05:18 PM
arlu1201 Re: Macro copy data from... 03-01-2013, 01:54 AM
pram Re: Macro copy data from... 03-07-2013, 04:43 PM
arlu1201 Re: Macro copy data from... 03-08-2013, 10:43 AM
pram Re: Macro copy data from... 03-08-2013, 03:31 PM
arlu1201 Re: Macro copy data from... 03-11-2013, 06:50 AM
pram Re: Macro copy data from... 03-11-2013, 03:50 PM
arlu1201 Re: Macro copy data from... 03-11-2013, 03:55 PM
pram Re: Macro copy data from... 03-11-2013, 04:04 PM
arlu1201 Re: Macro copy data from... 03-12-2013, 01:31 AM
pram Re: Macro copy data from... 03-12-2013, 02:29 PM
pram Re: Macro copy data from... 03-13-2013, 03:58 PM
arlu1201 Re: Macro copy data from... 03-13-2013, 06:43 AM
arlu1201 Re: Macro copy data from... 03-14-2013, 03:41 AM
pram Re: Macro copy data from... 03-14-2013, 02:45 PM
arlu1201 Re: Macro copy data from... 03-15-2013, 01:16 AM
pram Re: Macro copy data from... 03-15-2013, 03:08 PM
arlu1201 Re: Macro copy data from... 03-15-2013, 03:14 PM
  1. #1
    Registered User
    Join Date
    07-26-2012
    Location
    delhi
    MS-Off Ver
    Excel 2003
    Posts
    13

    Re: Macro copy data from multiple workbooks to master

    Hi Arlu,
    Thanks for your quick responce but
    I am geting compilation error msg 9 at bold section can u please check and reply me as i am seeing u r online this time.

    Option Explicit
    
    Sub cons_data()
    
    Dim Master As Workbook
    Dim sourceBook As Workbook
    Dim sourceData As Worksheet
    Dim CurrentFileName As String
    Dim myPath As String
    
    Application.ScreenUpdating = False
    
    'The folder containing the files to be recap'd
    myPath = "C:\Score"
    
    'Finds the name of the first file of type .xls in the current directory
    CurrentFileName = Dir(myPath & "\*.xlsx")
    
    'Create a workbook for the recap report
    Set Master = ThisWorkbook
    
    Do
        Workbooks.Open (myPath & "" & CurrentFileName)
        Set sourceBook = Workbooks(CurrentFileName)
        Set sourceData = sourceBook.Worksheets(1)
        
            With sourceData
                .Range("A2:B2").Copy Master.Worksheets(1).Range("A" & Rows.Count).End(xlUp).Offset(1, 0)
                
            End With
           
        sourceBook.Close
      
    'Calling DIR w/o argument finds the next .xlsx file within the current directory.
    CurrentFileName = Dir()
    Loop While CurrentFileName <> ""
    
    MsgBox "Done"
    
    Application.ScreenUpdating = True
    
    End Sub
    Last edited by arlu1201; 03-11-2013 at 03:54 PM.

+ 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