View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.misc
Tom Tom is offline
external usenet poster
 
Posts: 19
Default How to increment the date

This is going to save me a lot of time. Skipping the weekends, presumably I
can next change the 11 in the dateserial to 18 and continue with the 2nd
week. However, can you create another loop to do this? Many thanks Dave.

Tom

"Dave Peterson" wrote in message
...
Dim myStr as string
dim dCtr as long
dim myDate as date

for dctr = 1 to 5
myDate = dctr - 1 + dateserial(2006,12,11)
mystr = "C:\somepath\" & format(myDate,"yyyymmdd") & ".txt"
'open the file named myStr
'do some work
'close that .txt file
next dctr


Tom wrote:

I use a macro to open the file 20061211.txt which is named after the
date,
and extract some
data before closing it. I then repeat the process and open up the next
file
20061212.txt and so on till I reach the last file 20061215.txt. I would
like to be able to use For N =1 to 5 and Next N, to automate the process
but
I don't know how to increment the date by one each time. Any help will be
much appreciated.

TIA
Tom


--

Dave Peterson