AdamMalbon
New Member
- Joined
- Nov 7, 2018
- Messages
- 6
Sorry if this is similar to previous posts. I can't quite find one that solves my problem. I am attempting to compile multiple daily data tables into a database containing several years of information. I want to skip my personal macro workbook, as well as the sheet I am pasting into. This code works until it hits my master workbook ("FRMC.xlsm"). It will not jump to the next open workbook, it just loops through the if statement perpetually. Code below:
Code:
Sub compileFR()
Dim wb As workbook
For Each wb In Application.Workbooks
If wb.Name = "Personal.xlsb" Or wb.Name = "frmc.xlsm" Then
'Do nothing
Else
Sheets("MASTER").Select
Range("b3", Range("b3").End(xlDown).Offset(0, 12)).Select
selection.Copy
Windows("frmc.xlsm").Activate
Range("a3").End(xlDown).Offset(1, 0).Select
selection.PasteSpecial Paste:=xlPasteValues
Columns("A:A").Select
selection.NumberFormat = "m/d/yyyy"
ActiveWorkbook.Save
Columns("A:M").Select
ActiveSheet.Range("$A$1:$M$25795").RemoveDuplicates Columns:=Array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13), Header:=xlYes
Application.CutCopyMode = False
Application.DisplayAlerts = False
wb.Close (n)
End If
Next
End Sub