ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Combining Macro Files (https://www.excelbanter.com/excel-programming/303520-combining-macro-files.html)

CPower[_20_]

Combining Macro Files
 
Hi all,

I have just finished creating 3 macros for one team in my company i.e
.xls files. For me to run these macros i have to firstly open 3 ra
data files (backlog, closed and opened cases). Then i have to open th
three macro files (Team1BacklogMacro, Team1ClosedMacro an
Team1OpenMacro). Then i have to go to each raw data file , run th
correct Macro, then save it under Team1BacklogCases, Team1....etc. As
will have to do this process with 4 teams, i would like to know i
there is a way of making this automatic, i.e. have a master macro tha
will ask for the file location of the raw data and the macro files
then run them all and then prompt for what each file will be saved as


Is there any one out there that could please help?
Any ideas on this would be great.

Thanks in advance,
Catha

--
Message posted from http://www.ExcelForum.com


Mike Fogleman

Combining Macro Files
 
This sounds like you want to "Get External Data" from a database file and
then manipulate that data with macros. I have done this from 1 workbook.
Each data file will be on a different sheet in the workbook. From there the
data can be filtered by Team1, Team2, etc as needed. Then run your macros on
the appropriate sheets that are filtered by team and save as Team whatever.
That way there would be 1 workbook for each team saved with all 3 sheets
included (backlog, closed, & open).

email me from your work or home and I can get you started with some example
code or workbook. I will need some particulars on what you are doing.
Mike F
"CPower " wrote in message
...
Hi all,

I have just finished creating 3 macros for one team in my company i.e 3
xls files. For me to run these macros i have to firstly open 3 raw
data files (backlog, closed and opened cases). Then i have to open the
three macro files (Team1BacklogMacro, Team1ClosedMacro and
Team1OpenMacro). Then i have to go to each raw data file , run the
correct Macro, then save it under Team1BacklogCases, Team1....etc. As i
will have to do this process with 4 teams, i would like to know if
there is a way of making this automatic, i.e. have a master macro that
will ask for the file location of the raw data and the macro files,
then run them all and then prompt for what each file will be saved as.


Is there any one out there that could please help?
Any ideas on this would be great.

Thanks in advance,
Cathal


---
Message posted from http://www.ExcelForum.com/




Dave Peterson[_3_]

Combining Macro Files
 
I think I'd combine my 3 macros into one workbook and add a little more to get
the names of the files to open.

Then have the user open my giant combined macro workbook.

The little extra could look something like:

Option Explicit
Sub testme()

Dim wkbkNames(1 To 3) As String
Dim wkbks(1 To 3) As Workbook
Dim iCtr As Long
Dim myTitles(1 To 3) As String
Dim myFileName As Variant

myTitles(1) = "backlog"
myTitles(2) = "closed"
myTitles(3) = "open"

For iCtr = LBound(wkbks) To UBound(wkbks)
myFileName = Application.GetOpenFilename _
(Title:="Please select " & myTitles(iCtr) & " file")
If myFileName = False Then
Exit Sub
Else
wkbkNames(iCtr) = myFileName
End If
Next iCtr

For iCtr = LBound(wkbks) To UBound(wkbks)
'whatever you do to open them
Set wkbks(iCtr) = Workbooks.Open(wkbkNames(iCtr))
Next iCtr

End Sub

Now you have 3 files open and in variables wkbks(1), wkbks(2), and wkbks(3).

You can refer to those workbooks in your other macros.


Sub firstrealmacro(wkbk as workbook)
'do all your work
end sub

And call it like:

call firstrealmacro(wkbks(1))



"CPower <" wrote:

Hi all,

I have just finished creating 3 macros for one team in my company i.e 3
xls files. For me to run these macros i have to firstly open 3 raw
data files (backlog, closed and opened cases). Then i have to open the
three macro files (Team1BacklogMacro, Team1ClosedMacro and
Team1OpenMacro). Then i have to go to each raw data file , run the
correct Macro, then save it under Team1BacklogCases, Team1....etc. As i
will have to do this process with 4 teams, i would like to know if
there is a way of making this automatic, i.e. have a master macro that
will ask for the file location of the raw data and the macro files,
then run them all and then prompt for what each file will be saved as.

Is there any one out there that could please help?
Any ideas on this would be great.

Thanks in advance,
Cathal

---
Message posted from http://www.ExcelForum.com/


--

Dave Peterson


CPower[_22_]

Combining Macro Files
 
would you be able to give me your email address please Mike?

Thanks for this help,
Catha

--
Message posted from http://www.ExcelForum.com


Mike Fogleman

Combining Macro Files
 

"CPower " wrote in message
...
would you be able to give me your email address please Mike?

Thanks for this help,
Cathal


---
Message posted from
http://www.ExcelForum.com/





All times are GMT +1. The time now is 11:37 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com