Sub som()
Dim WB(1 To 5) As String
WB(1) = "GeneratorOutages 1 .xls"
WB(2) = "BreakerOutages[1].xls"
WB(3) = "TransformerOutages 1 .xls"
WB(4) = "TransmissionOutages 1 .xls"
WB(5) = "NOPOutages[1].xls"
For i = 1 To 5
Windows(WB(i)).Activate
With ActiveSheet
'Add filter
.AutoFilterMode = False
'Filter and copy data by BFN-500
With Range("F1", Range("F" & Rows.Count).End(xlUp))
.AutoFilter 1, "*BFN-500*"
If Range("A2") = "" Then
Next i
Else
Rows("2:2").Select
Range(Selection, Selection.End(xlDown)).Select
Selection.Copy
On Error Resume Next
'----SELECT THE RIGHT DATA to copy---------
Windows("NOP_Data.xls").Activate
Sheets("BFN-500").Select
'find empty the next cell in cal A and paste data
Set FirstBlankCell = Range("A" & Rows.Count).End(xlUp).Offset(1, 0)
FirstBlankCell.Activate
ActiveSheet.Paste
End With
.AutoFilterMode = False
End With
End If
Next
End Sub