Many WorkBooks to Summary WB


New Member
Jul 8, 2012
Hello to one in this wonderful forum!

I need some help on a Macro.

I have a folder with many Excel WorkBooks in it. All the WBs are encrypted by the same password.

The data in these WBs are in Sheet1, in the Column C5:C10.

The Macro should open each WB in the Folder and copy the data from C5:C10 and paste it in a Summary File in a Transpose manner, starting from Row 2. The data from each and every WB should be below each other, I mean; Row 3, Row 4......

As the Password for opening all the WBs are same, the Macro should open the WBs with the same password and it should not promt for password everytime it opens a file.

Any help would be appreciated.

Some videos you may like

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.


Active Member
Oct 16, 2011
You will need to supply the Passwod and Path in the Two constants at the start of the SUB. Otherwise, this code should work per you requirements

Function Process()
    Const pswd As String = "DDD"
    Const InitPath As String = "C:\Documents and Settings\cpelab\My Documents"
    Dim FilePath As String
    Dim WbSrc As Workbook
    Dim RngSrc As Range
    Dim I As Integer
    Dim WsDst As Worksheet
    Dim DstRowNo As Long
    Set WsDst = ThisWorkbook.Worksheets(1)
    DstRowNo = 2
    ChDir InitPath
    FilePath = Dir("*.xls")
    Do While FilePath <> ""
        Debug.Print FilePath
        Set WbSrc = Workbooks.Open(Filename:=FilePath, ReadOnly:=True, Password:=pswd)
        Set RngSrc = WbSrc.Worksheets(1).Range("C5:C10")
        For I = 1 To RngSrc.Rows.Count
            WsDst.Cells(DstRowNo, I) = RngSrc.Cells(I, 1)
        Next I
        Call WbSrc.Close(SaveChangeS:=False)
        DstRowNo = DstRowNo + 1
        FilePath = Dir
End Function


New Member
Jul 8, 2012
Hello Downey. Your codes work perfectly as desired. Thank you very much for your time and help. :)

Watch MrExcel Video

Forum statistics

Latest member

This Week's Hot Topics

  • Finding issue in If elseif else with For each Loop
    Finding issue in If elseif else with For each Loop I have tried this below code but i'm getting in Y column filled with W005. Colud you please...
  • MsgBox Error
    Hi Guys, I have the below error show up when i try and run my macro in File1 but works fine if i copy and paste the same code into file2. [ATTACH...
    My Cell Format is [B]""0.00" Cr". [/B]But in the cell, it is showing 123.00 for editing. (123 is entry figure). (Data imported from other...
  • Show numbers nearly the same
    Is this possible. I have a number that can change very time eg 0.00001234 Then I have a lot of numbers 0.0000001, 0.0000002, 0.00000004...
  • Please i need your help to create formula
    I need a formula in cell B8 to do this >>if b1=1 then multiply ( cell b8) by 10% ,if b1=2 multiply by 20%,if=3 multiply by 30%. Thank you in...
  • Got error while adding column and filter
    Got error while adding column and filter In column Z has some like "Success" and "Error". I want to add column in AA if the Z cell value is...