Combine multiple workbooks into one

smakcc

New Member
Joined
Nov 22, 2011
Messages
5
Hi all,

I really need some help here. I would like to get a macro that does the following:

1. Prompt user to select folder with excel files.

2. Combine the workbooks into one master workbook. Each workbook should have its own sheet in the Master workbook.

3. Compare the column called "rates"(this is the E column) for any changes in row values (decimal values) between sheets in the Master workbook.

If there is an increase or decrease in the row values copy the two values to a third sheet.
Sheet 3 should have column names

"Reference Row Id" - displays the row number were the difference was found.
"Rate 1" - Row value of column "rate" found in sheet 1
"Rate 2" - Row value of column "rate" found in sheet 2
"Percentage" - Increase or decrease percentage between values found in the columns "Rate1" and "Rate2"

Thanks.
 

Excel Facts

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.
What have you tried to create so far any code ? Just out of interest what version of Excel are you using.?
 
Upvote 0
I am using Office 2007.

I have tried several macros to combine the workbook into one none have worked. Currently trying this

Option Explicit

Sub Merge2MultiSheets()
Dim wbDst As Workbook, wbSrc As Workbook
Dim MyPath As String, strFilename As String

Application.DisplayAlerts = False
Application.EnableEvents = False
Application.ScreenUpdating = False

MyPath = "C:\Temp" ' change to suit
Set wbDst = Workbooks.Add(xlWBATWorksheet)
strFilename = Dir(MyPath & "\*.xls", vbNormal)

If Len(strFilename) = 0 Then Exit Sub

Do Until strFilename = ""
Set wbSrc = Workbooks.Open(Filename:=MyPath & "\" & strFilename)

wbSrc.Sheets(1).Name = Left(strFilename, InStrRev(1, strFilename, ".") - 1)
wbSrc.Sheets(1).Copy After:=wbDst.Worksheets(wbDst.Worksheets.Count)
wbSrc.Close False

strFilename = Dir()
Loop

wbDst.Sheets(1).Delete

Call SortWorksheets(wbDst, False)

Application.DisplayAlerts = True
Application.EnableEvents = True
Application.ScreenUpdating = True
End Sub
 
Upvote 0

Forum statistics

Threads
1,223,236
Messages
6,170,917
Members
452,366
Latest member
TePunaBloke

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