Merging Workbooks

naimfarah

New Member
Joined
Feb 21, 2006
Messages
4
I have 12 workbooks all in the same format and I want to create a one page summary page summarizing my data - is there an easy way to do this? What I need to do is sum up one column and in another column create a weighted average for cost using a volume column (the one in which I am summing) and a price column. I am pulling in volume and creating an average dead net price from the volume and dead net price on each sheet.




Program Volume (Raw Cases) Strike Price Dead Net Price Support per Case Reimbursement ($)
Program 1 $5.00 $5.00 $-
Program 2 $8.00 $8.00 $-
 
Last edited:

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.
This is the basic idea I use for these consolidations:

Code:
Sub import_data()
Dim i As Long, _
    next_row As Long, _
    master_wkb As Workbook, _
    form_wkb As Workbook, _
    SRfilenames As Variant, _
    fileindex As Integer, _
    filename As String

Set master_wkb = Workbooks(ThisWorkbook.Name)
        
master_wkb.Sheets("Data").Range("2:" & Rows.Count).Delete

'Select files
SRfilenames = Application.GetOpenFilename( _
fileFilter:="Excel,*.xls", _
Title:="Select one or more import files", _
MultiSelect:=True)

Application.ScreenUpdating = False

'Loop through selected files

If Not IsArray(SRfilenames) Then Exit Sub
        
For fileindex = LBound(SRfilenames) To UBound(SRfilenames)
filename = SRfilenames(fileindex)
Workbooks.Open (filename)
Set form_wkb = Workbooks(ActiveWorkbook.Name)
master_wkb.Activate
    
'*******
'*******
'actual import goes here... the code here depends on the arrangement of your input 
'files and desired layout for your master workbook
'*******
'*******

form_wkb.Activate
form_wkb.Close saveChanges:=False
Next fileindex
Application.ScreenUpdating = True
End Sub
 
Upvote 0

Forum statistics

Threads
1,215,029
Messages
6,122,757
Members
449,094
Latest member
dsharae57

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top