View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
Dave Peterson Dave Peterson is offline
external usenet poster
 
Posts: 35,218
Default How can the date be automated?

How about:

ActiveCell.Value = Date

ActiveCell.FormulaR1C1 = "=OPEN(""D:\Chart\" _
& Format(Date, "yyyymmdd") & ".TXT"",,,2)"

And I bet you change cells before you run both of these, right?

And the second line blew up for me if I wasn't on a macro sheet.


Tom wrote:

Before I could run my program, there are 2 places in it where I have to edit
to show the current date (weekend dates excluded). Is there a way to get
around it so that each time when the program is run, the date quantity
(different format) is automatically increased by one on a week-day but by
three on a week-end? Those two lines are as shown below:

ActiveCell.FormulaR1C1 = "=DATE(2007,4,20)" ' <- Current date
ActiveCell.FormulaR1C1 = "=OPEN(""D:\Chart\20070420.TXT"",,,2)" ' <-
Current date

Thank you if you can help.

Tom


--

Dave Peterson