hjgoldstein
Programmer
Hi all.
I have a macro in Excel 2007 which is referencing a filename in a vlookup.
The relevant part of the macro, when I set it up yesterday, was
which was fine.
Today, of course, it should refer to the same filename with today's date and here is my problem.
I have tried various permutations and the closest I can get is:
which brings up a dialogue box asking for a filename. It seems to have taken the CSVFilename variable but left off the yyyy-mm and only included the dd part.
Where am I going wrong?
Aspiring to mediocrity since 1957
I have a macro in Excel 2007 which is referencing a filename in a vlookup.
The relevant part of the macro, when I set it up yesterday, was
Code:
"=VLOOKUP(RC[-1],'2013-02-27_Utilisation.csv'!C15:C16,2,FALSE)"
Today, of course, it should refer to the same filename with today's date and here is my problem.
I have tried various permutations and the closest I can get is:
Code:
Dim FilenamePrefix As String
FilenamePrefix = Format(Date, "yyyy-mm-dd")
Dim CSVFilename As String
CSVFilename = FilenamePrefix & "_Utilisation.csv"
ActiveCell.FormulaR1C1 = _
"=VLOOKUP(RC[-1]," & CSVFilename & "!C15:C16,2,FALSE)"
Where am I going wrong?
Aspiring to mediocrity since 1957