Thank Rick, but Bob Phillips has a great solution that works with the
open xls file and does not require creating any variables. Actually, I
realized that the macro I used to create the file only needed an
instruction to post the date value in cell c1 and then post the
previous day's date in cell e1 so that values from the prior day can
be compared.
My original problem was how to extract data from the filename and I
knew of no way to set up the filename as part of the macro. Appreciate
your help. Don
On Jul 12, 9:38*am, "Rick Rothstein \(MVP -
VB\)"
wrote:
Assuming you have the filename in a String variable and that the filename
has an extension (assumed to be CSV for the following example, but the code
will work for any 3-character extension)...
Filename = "Daily 2008 07 12.csv"
TheDate = CDate(Replace(Mid(Filename, Len(Filename) - 13, 10), " ", "-"))
Rick
"HappySenior" wrote in message
...
I have a macro that creates a series of workbooks named in the format
"Daily yyyy mm dd" which works fine.
My daily worksheets require a column headed by the date and another
column headed by the preceding day's date. That column links to the
prior day's worksheet to bring forward end of the day values.
I'm a newbie (retired CPA) at VBA and would appreciate suggestions
about how to extract the right 10 characters of the file name and
convert them to a date in cell c1 on sheet 1.
Many thanks
Don- Hide quoted text -
- Show quoted text -