Macro recorded... tabs & file names changed, macro hangs

S

Steve

If have recorded a macro that selects various tabs ( sample 1)

and another macro that indicates the name of the file ( sample 2).

sample 1 Sheets(Array("MasterTab", "Data 10-28-09", "Tdata
10-28-09")).Copy

sample 2 Windows("BASEOct28.xls").Activate

Being that I rename the various tabs when I update them ( 10-29, etc), and
also save the file as the updated date (BaseOct29.xls), the macros do not
work because they're looking for the tabs with the 10-28 date, which have
been re-named 10-29, and same for the file. Is there a way to have the macro
work with the new dates ?

Thanks,

Steve
 
J

JBeaucaire

Maybe like this:

Sheets(Array("MasterTab", "Data " & Format(Date, "MM-DD-YY"), "Tdata " &
Format(Date, "MM-DD-YY"))).Copy

That would convert the second two tabs to today's date.
 
J

JBeaucaire

And for sample2:

Windows("BASE" & Format(Date, "MMMDD") & ".xls").Activate

Does that help?
 
S

Steve

I haven't tried this yet, but I will. However, I only change the dates on the
tabs and the file if I make changes to them. E.g., these changes would use
todays date, but the tabs or even file may have not been updated for a week,
and they'd still have a prior days date on them, then the macro would not
work, correct ? I guess what I was thinking of is like when you change the
name of a tab that's in a formula, the formula changes to that new tab name.
Or something like that.

Thanks,

Steve
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top