I currently have this macro below. The sheet name will remain the same but the Window's workbook name will change each month. How can I have this macro run off of any workbook that has any particular sheet name I might mention.
Sub AgedwoActiveContractDetails()
'
' Macro1 Macro
'
'
Windows("Copy of DRAFT - CIO Level VPS Reporting - 05 31 16.xlsx").Activate
Sheets("Aged wo Active Contract Details").Select
Dim arrColOrder As Variant, ndx As Integer
Dim Found As Range, counter As Integer
'Place the column headers in the end result order you want.
arrColOrder = Array("Top Level Vendor BE Name", "LOB VE", "Enterprise Vendor Manager", "Ariba ID", "Top Level Vendor BE ID", _
"Grouping II", "Top Level Vendor Risk Level", "LOB Owner", "Top Level Vendor Lead Region", "Classification")
counter = 1
Application.ScreenUpdating = False
For ndx = LBound(arrColOrder) To UBound(arrColOrder)
Set Found = Rows("1:1").Find(arrColOrder(ndx), LookIn:=xlValues, LookAt:=xlWhole, _
SearchOrder:=xlByColumns, SearchDirection:=xlNext, MatchCase:=False)
If Not Found Is Nothing Then
If Found.Column <> counter Then
Found.EntireColumn.Cut
Columns(counter).Insert Shift:=xlToRight
Application.CutCopyMode = False
End If
counter = counter + 1
End If
Next ndx
Application.ScreenUpdating = True
End Sub
Sub AgedwoActiveContractDetails()
'
' Macro1 Macro
'
'
Windows("Copy of DRAFT - CIO Level VPS Reporting - 05 31 16.xlsx").Activate
Sheets("Aged wo Active Contract Details").Select
Dim arrColOrder As Variant, ndx As Integer
Dim Found As Range, counter As Integer
'Place the column headers in the end result order you want.
arrColOrder = Array("Top Level Vendor BE Name", "LOB VE", "Enterprise Vendor Manager", "Ariba ID", "Top Level Vendor BE ID", _
"Grouping II", "Top Level Vendor Risk Level", "LOB Owner", "Top Level Vendor Lead Region", "Classification")
counter = 1
Application.ScreenUpdating = False
For ndx = LBound(arrColOrder) To UBound(arrColOrder)
Set Found = Rows("1:1").Find(arrColOrder(ndx), LookIn:=xlValues, LookAt:=xlWhole, _
SearchOrder:=xlByColumns, SearchDirection:=xlNext, MatchCase:=False)
If Not Found Is Nothing Then
If Found.Column <> counter Then
Found.EntireColumn.Cut
Columns(counter).Insert Shift:=xlToRight
Application.CutCopyMode = False
End If
counter = counter + 1
End If
Next ndx
Application.ScreenUpdating = True
End Sub