Results 1 to 3 of 3

ConsolidateData Macro

Threaded View

  1. #1
    Registered User
    Join Date
    11-09-2011
    Location
    Sliven, Bulgaria
    MS-Off Ver
    Excel 2003
    Posts
    2

    ConsolidateData Macro

    Hi all,
    I have little issue here.
    I have 100 files in one directory and I wanted to consolidate them all in one single file. For that I have following code:
    Sub ConsolidateData()
    '
    ' ConsolidateData Macro
    '
    
       Dim file As String
       Dim path As String
       
       path = InputBox("Type the file part ending with '\'")
       file = Dir(path)
       
    Do While file <> ""
        ' ChDir (path)
        Workbooks.Open Filename:=path & file
        Range("A65000").Select
        Selection.End(xlUp).Select
        'open the file and select the range
        
        Selection.CurrentRegion.Select
        Selection.Copy
        'copy the data
        
        Windows("Daily_Report_Data_Consolidation_MACRO.xlsm").Activate
        Range("A1000000").Select
        Selection.End(xlUp).Select
        ActiveCell.Offset(1, 0).Select
        Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
            :=False, Transpose:=False
        
        ' close file
        Windows(file).Activate
        ActiveWindow.Close
              
        file = Dir
    Loop
        
        'ActiveWorkbook.SaveAs Filename:="F:\Branches\all.xlsx", _
        '    FileFormat:=xlOpenXMLWorkbook, CreateBackup:=True
    
    End Sub
    The branch files looks like this:
    A                              B                       C                      D              E              F               G 
    1 Date			Number		Name		        Comment	Type		Channel	Branch
    2 07 Февруари 2012 г.	72397801245	Name here 1	Comment 1	Campaign	DM	        098-IUO
    3 07 Февруари 2012 г.	72397801245	Name here 1	Comment 2	Repeat	IVR	        067-MNB
    4 07 Февруари 2012 г.	72397801245	Name here 1	Comment 3	New		Internet	065-NBV
    The code above works perfectly but copy the first row from branches files. I don't want to does that. I want to skip range A1:G1.
    Please could someone provide me help and to modify this code?

    The consolidation file in blank.

    Fell free to use this code.
    Last edited by viktorov; 02-28-2012 at 08:46 AM.

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