Reply to topic  [ 13 posts ] 
Excel : Macro to run a set of tasks, but on different files? 
Author Message
Doesn't have much of a life

Joined: Tue Apr 28, 2009 11:45 am
Posts: 732
Location: 'sup mah science bitchezz!?
Reply with quote
Okay,

Each morning I have to do a back order analysis. I have to hide this column, hide that column, fill this column, fill that column, resize these columns, create these sheets, write these formulas... each day, the same thing, the same formulas, the same everything.

Now, the only thing is, each day there is a new file. With diffrent information. So if you can see what I mean, I need to file to be automated, to save about an hour of my day.

Any ideas on acheiving this?

_________________
Image I make full use of this action, while at x404.


Tue Oct 13, 2009 3:38 pm
Profile
I haven't seen my friends in so long
User avatar

Joined: Thu Apr 23, 2009 6:36 pm
Posts: 5150
Location: /dev/tty0
Reply with quote
Don't ask me how, but can't you attach a macro to the Normal template (or any other template for that matter)? Does this apply in Excel or is this just a word thing?
As long as you use the said template, the macro will be included...


Tue Oct 13, 2009 3:51 pm
Profile WWW
Doesn't have much of a life

Joined: Tue Apr 28, 2009 11:45 am
Posts: 732
Location: 'sup mah science bitchezz!?
Reply with quote
This is what I'm trying to wrap my head around...

A report is run at 6pm in the evening. I come in in the morning and analyise the information, and segment all the imformation into sheets.

So because I don't run the report, I can't tell it how to be set up.

I also can't loose any information, so it's very very vital to have things in tact. Ah I'm going out of my mind.

_________________
Image I make full use of this action, while at x404.


Tue Oct 13, 2009 3:53 pm
Profile
Site Admin
User avatar

Joined: Fri Apr 24, 2009 6:12 am
Posts: 7011
Location: Wiltshire
Reply with quote
bish wrote:
So because I don't run the report, I can't tell it how to be set up.


Unless you can control the file creation you can't even import it into a template spreadsheet......... sorry.

As there is a quantifiable saving get mgt to issue a directive that the report will be created in the following format / using the following template blah blah blah. :D

_________________
<input type="pickmeup" name="coffee" value="espresso" />


Tue Oct 13, 2009 4:01 pm
Profile WWW
Spends far too much time on here
User avatar

Joined: Thu Apr 23, 2009 6:44 pm
Posts: 4141
Location: Exeter
Reply with quote
Write your macro to a master file. When you come to edit your new workbook, simply have your master file open in the background and you'll be able to access the macro.

_________________
"The woman is a riddle inside a mystery wrapped in an enigma I've had sex with."


Tue Oct 13, 2009 6:18 pm
Profile WWW
What's a life?
User avatar

Joined: Thu Apr 23, 2009 8:25 pm
Posts: 10691
Location: Bramsche
Reply with quote
Correct Jon,

The Macro should even be able to prompt for the file to be opened, then work on it... Or if the report file is in a specific location and has a specific naming convention based on date, for example, the name can be calculated and automatically opened and then manipulated.

One of the first Excel macros I wrote, back in 1988, opened around 200 separate worksheets, one after the other and extracted timesheet information for each employee and added it to a new master table.

_________________
"Do you know what this is? Hmm? No, I can see you do not. You have that vacant look in your eyes, which says hold my head to your ear, you will hear the sea!" - Londo Molari

Executive Producer No Agenda Show 246


Wed Oct 14, 2009 6:38 am
Profile ICQ
Doesn't have much of a life

Joined: Tue Apr 28, 2009 11:45 am
Posts: 732
Location: 'sup mah science bitchezz!?
Reply with quote
Hmm, seems like big_D can help...

What do you propose i do?

_________________
Image I make full use of this action, while at x404.


Wed Oct 14, 2009 7:33 am
Profile
Spends far too much time on here
User avatar

Joined: Thu Apr 23, 2009 6:44 pm
Posts: 4141
Location: Exeter
Reply with quote
What's your level of macro writing skill like?

For a lot of stuff, simply using the Record Macro function is the most straightforward option. It cannot do anything conditional, but if you are doing the same thing to your spreadsheet every morning then that may well not be an issue. Things like pasting formulas are easily covered by the Record function.

_________________
"The woman is a riddle inside a mystery wrapped in an enigma I've had sex with."


Wed Oct 14, 2009 9:25 am
Profile WWW
Doesn't have much of a life

Joined: Tue Apr 28, 2009 11:45 am
Posts: 732
Location: 'sup mah science bitchezz!?
Reply with quote
Jon, I know quite basic VB, nothing like amazing, just the basics.

I'd probably use the record macro for this sort of thing, because it kind of kills 2 birds with one stone!

Problem is, recording the macro is fine, but then how do I get the macro to run on different, seperate files?

_________________
Image I make full use of this action, while at x404.


Wed Oct 14, 2009 9:33 am
Profile
Spends far too much time on here
User avatar

Joined: Thu Apr 23, 2009 6:44 pm
Posts: 4141
Location: Exeter
Reply with quote
bish wrote:
Jon, I know quite basic VB, nothing like amazing, just the basics.

I'd probably use the record macro for this sort of thing, because it kind of kills 2 birds with one stone!

Problem is, recording the macro is fine, but then how do I get the macro to run on different, seperate files?


Save a copy of the file you are working on, and record the macro. We'll call it Master.xls

Then, in subsequent times, open the file you want to run the macro on (edit.xls), open Master.xls and in the Macros box in edit.xls you will find the macro stored in Master.xls, which you can then run.

_________________
"The woman is a riddle inside a mystery wrapped in an enigma I've had sex with."


Wed Oct 14, 2009 9:38 am
Profile WWW
I haven't seen my friends in so long
User avatar

Joined: Thu Apr 23, 2009 6:36 pm
Posts: 5150
Location: /dev/tty0
Reply with quote
bish wrote:
Jon, I know quite basic VB, nothing like amazing, just the basics.


After not writing Macros for three years I suddenly had to write a load of them over the summer. Google is your friend here :)


Wed Oct 14, 2009 10:01 am
Profile WWW
What's a life?
User avatar

Joined: Thu Apr 23, 2009 8:25 pm
Posts: 10691
Location: Bramsche
Reply with quote
Record the Macro from a new worksheet, open the worksheet you want to edit, make the edits etc. and save the changes.

Then go back and use an Input box for the file name and substitute the filename in the open and save commands for the one you got from the Input box.

_________________
"Do you know what this is? Hmm? No, I can see you do not. You have that vacant look in your eyes, which says hold my head to your ear, you will hear the sea!" - Londo Molari

Executive Producer No Agenda Show 246


Wed Oct 14, 2009 11:09 am
Profile ICQ
Site Admin
User avatar

Joined: Fri Apr 24, 2009 6:12 am
Posts: 7011
Location: Wiltshire
Reply with quote
Guys unless the report is in a set format, the same every day I don't see how the macros will work.

You can tell a macro to get information from a set location or very limited flexibility but if the information isn't where it expects it .........................

First step get control of the report creation and the format its out put in.

_________________
<input type="pickmeup" name="coffee" value="espresso" />


Thu Oct 15, 2009 7:01 am
Profile WWW
Display posts from previous:  Sort by  
Reply to topic   [ 13 posts ] 

Who is online

Users browsing this forum: No registered users and 24 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group
Designed by ST Software.