ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Macro File Help (https://www.excelbanter.com/excel-programming/307365-macro-file-help.html)

alexm999[_84_]

Macro File Help
 
I run a macro that opens up a file that is named for the Previous date
For example, today is Aug 18, 2004 so the file I open will be 17.txt

I have 31 Macro's - 1 each for the day of the week. Is there an easie
way for me to run only 1 macro and it will automatically grab th
correct previous days file

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


Tom Ogilvy

Macro File Help
 
workbooks.Open Day(Date-1) & ".txt"

testing in the immediate window:

? day(date-1)
17
? day(DateValue("September 1, 2004")-1)
31


--
Regards,
Tom Ogilvy

"alexm999 " wrote in message
...
I run a macro that opens up a file that is named for the Previous date.
For example, today is Aug 18, 2004 so the file I open will be 17.txt

I have 31 Macro's - 1 each for the day of the week. Is there an easier
way for me to run only 1 macro and it will automatically grab the
correct previous days file?


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




alexm999[_85_]

Macro File Help
 
Thanks for the quick reply. Here's another question regarding thi
matter.

If the file is in the C:\UDC directory, how will I call this using th
function, i'm having difficulties

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


alexm999[_86_]

Macro File Help
 
Here's one more...

After I run the file TODAY, then when i run it tomorrow, i'd like it t
skip to the next row so the first row is not deleted.

I'm starting it in Cell A6 and going down 31 cells

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


Tom Ogilvy

Macro File Help
 
workbooks.open "C:\UDC\" & day(date-1) & ".txt"
cells(day(date-1)+5,1).Activate

--
Regards,
Tom Ogilvy


"alexm999 " wrote in message
...
Here's one more...

After I run the file TODAY, then when i run it tomorrow, i'd like it to
skip to the next row so the first row is not deleted.

I'm starting it in Cell A6 and going down 31 cells.


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





All times are GMT +1. The time now is 03:14 AM.

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