macro help

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,

I have a macro that completes lots of stuff for me from a particular
worksheet in another workbook.

I want this part of my code....

Windows("HXTCNC DATA FOR THU 30-NOV-06.XLS").Activate

to be replaced with code that will automaticaly open the workbook with the
same name ie 'HXTCNC DATA FOR' but for TODAY()+1 in the format dd-mmm-yy.

For example if I ran the macro now it would look for the workbook
named.......

HXTCNC DATA FOR MON 04-DEC-06.XLS

Thanks in advance
 
This can be done in one step, but its easier to follow this way:

s = Now + 1
s1 = UCase(Application.WorksheetFunction.Text(s, "ddd")) & " "
s2 = UCase(Application.WorksheetFunction.Text(s, "dd-mmm-yy"))
s3 = "HXTCNC DATA FOR " & s1 & s2 & ".XLS"
Windows(s).Activate
 
Thanks for the explanation -works well !

Gary''s Student said:
This can be done in one step, but its easier to follow this way:

s = Now + 1
s1 = UCase(Application.WorksheetFunction.Text(s, "ddd")) & " "
s2 = UCase(Application.WorksheetFunction.Text(s, "dd-mmm-yy"))
s3 = "HXTCNC DATA FOR " & s1 & s2 & ".XLS"
Windows(s).Activate
 

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

Back
Top