LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #7   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default How can the date be automated?

Glad it worked for you.



Tom wrote:

Once again you simply navigate your way around the problem and come up with
a neat solution. Only a person with good mastery of the subject can do that.
Congratulations, and many thanks, Dave.

"Dave Peterson" wrote in message
...
Dates are just numbers, so how about:
ActiveCell.Value = Date - 1
ActiveCell.FormulaR1C1 = "=OPEN(""D:\Chart\" _
& Format(Date-1, "yyyymmdd") & ".TXT"",,,2)"

Maybe better if you want to avoid Saturdays and Sundays.

Dim myDate as date
If Weekday(Date) = vbMonday Then
myDate = Date - 3
Else
myDate = Date - 1
End If
ActiveCell.Value = myDate
ActiveCell.FormulaR1C1 = "=OPEN(""D:\Chart\" _
& Format(myDate, "yyyymmdd") & ".TXT"",,,2)"





Tom wrote:

I nearly forgot. "ActiveCell.Value = Date" can't be used as it would be
using today's date.
Whereas, the program always uses the data that was collected the day
before
as today's data is not available until tomorrow after the market has
closed.

"Dave Peterson" wrote in message
...
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


--

Dave Peterson


--

Dave Peterson
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Automated calculations? What's the best way? Jim Moberg Excel Discussion (Misc queries) 0 October 17th 06 08:32 PM
Automated printing Newbeetle Excel Discussion (Misc queries) 2 September 24th 06 09:27 AM
Excel 2002 automated annual date change Cheryl Excel Discussion (Misc queries) 7 August 23rd 06 12:29 AM
Run automated macros ledzepe Excel Discussion (Misc queries) 1 August 4th 06 06:35 PM
Automated Linking deejayh Excel Discussion (Misc queries) 0 May 4th 06 01:26 PM


All times are GMT +1. The time now is 04:42 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"