Hi dani_n88
Assign the same Macro to each button...let me know of issues.
Sub Fetch1()
Dim intWB As Workbook, balWB As Workbook, idRow As Long
Dim r As Range
Dim myQtr As String
Dim myQtrCol As Long
Dim LR As Long
Dim LRint As Long
Dim LRbal As Long
Set r = ActiveSheet.Buttons(Application.Caller).TopLeftCell
myQtr = Range(Cells(r.Row, r.Column), Cells(r.Row, r.Column)).Offset(1, 0).Value
myQtrCol = r.Column
Application.ScreenUpdating = False ' turn off the screen updating
Set intWB = Workbooks.Open("c:\Excel Program\" & myQtr & "_Interest.xlsx", True, True)
LRint = ActiveWorkbook.Sheets("Sheet1").Range("A" & Rows.Count).End(xlUp).Row
Set balWB = Workbooks.Open("c:\Excel Program\" & myQtr & "_Balance.xlsx", True, True)
LRbal = ActiveWorkbook.Sheets("Sheet1").Range("A" & Rows.Count).End(xlUp).Row
' open the source workbook, read only
With ThisWorkbook.Worksheets("Sheet1")
LR = .Range("C" & .Rows.Count).End(xlUp).Row
' read data from the source workbook
For idRow = 3 To LR Step 5
Cells(idRow + 1, myQtrCol).Value = WorksheetFunction.VLookup(Range("C" & idRow), intWB.Worksheets("sheet1").Range("A1:B" & LRint), 2, False)
Cells(idRow + 2, myQtrCol).Value = WorksheetFunction.VLookup(Range("C" & idRow), balWB.Worksheets("sheet1").Range("A1:B" & LRbal), 2, False)
Next
End With
intWB.Close False ' close the source workbook without saving any changes
balWB.Close False
Set intWB = Nothing ' free memory
Set balWB = Nothing
Application.ScreenUpdating = True ' turn on the screen updating
End Sub
Bookmarks