I have
in my declarations(?) where GroupList is a table of 6 columns numbered 1-5 and X for the 6th one.
GroupX for this example is the column selected. With the following code,
the macro will open all files(named) in the column specified.
I also have six files, Group1-Group5 and GroupX. All files will have the same macros. I would like
to do one of two things:
either have a droplist showing the headers of each column, once selected and OK or Continue or whatever button is available, execute the macro specifically for that workbook... OR...
have the code read the name of the active workbook (Which could have something before or after "Group#" such as "Check GroupX.xlsm" or GroupX Check File.xlsm" and automatically look for that column and execute the macro.
So I need either a droplist to allow the macros be compatible with each file or somehow read the file name (the Group# part) and determine which table column to look at.
Thank you for any assistance provided.
-- g
Code:
Dim wbNames As Range: Set wbNames = Range("GroupList[GroupX]")
GroupX for this example is the column selected. With the following code,
Code:
Dim wb As Workbook
Dim strCPF As String
Dim wbNames As Range: Set wbNames = Range("GroupList[GroupX]")
Dim rngGroupList As Range
Application.DisplayAlerts = False
strCPF = "P" & Company.Function & " Accounts"
On Error Resume Next ' Work
For Each rngGroupList In wbNames
Set wb = Workbooks.Open("W:\Directory\" & Format(Now(), "yyyy") & _
"\CompanyFolder\" & strCPF & "\" & rngGroupList & ".xlsx")
If Not wb Is Nothing Then
Call b2_OpenDataFile
wb.Close False '
Set wb = Nothing '
End If
ActiveWorkbook.Save
Next rngGroupList
Sheets("DATA").Select
the macro will open all files(named) in the column specified.
I also have six files, Group1-Group5 and GroupX. All files will have the same macros. I would like
Code:
Dim wbNames As Range: Set wbNames = Range("GroupList[GroupX]")
either have a droplist showing the headers of each column, once selected and OK or Continue or whatever button is available, execute the macro specifically for that workbook... OR...
have the code read the name of the active workbook (Which could have something before or after "Group#" such as "Check GroupX.xlsm" or GroupX Check File.xlsm" and automatically look for that column and execute the macro.
So I need either a droplist to allow the macros be compatible with each file or somehow read the file name (the Group# part) and determine which table column to look at.
Thank you for any assistance provided.
-- g