-
Macro recorded... tabs & file names changed, macro hangs
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 -
RE: Macro recorded... tabs & file names changed, macro hangs
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.
--
"Actually, I *am* a rocket scientist." -- JB
(www.MadRocketScientist.com)
Your feedback is appreciated, click YES if this post helped you.
"Steve" wrote:
> 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 -
RE: Macro recorded... tabs & file names changed, macro hangs
And for sample2:
Windows("BASE" & Format(Date, "MMMDD") & ".xls").Activate
Does that help?
--
"Actually, I *am* a rocket scientist." -- JB
(www.MadRocketScientist.com)
Your feedback is appreciated, click YES if this post helped you.
"Steve" wrote:
> 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 -
RE: Macro recorded... tabs & file names changed, macro hangs
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
"JBeaucaire" wrote:
> 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.
> --
> "Actually, I *am* a rocket scientist." -- JB
> (www.MadRocketScientist.com)
>
> Your feedback is appreciated, click YES if this post helped you.
>
>
> "Steve" wrote:
>
> > 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 Posting Permissions - You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Bookmarks