Hi all,
I get a CSV file which I format and want to save as an Excel file.
In Cell A3 is always "Period : 02/06/2008 - 09/02/2008 " (Note final space as well)
I have been messing with code to extract various bits from the above as I want to save the file as:
Path & 2008 Jun 02 - 09.xls)
Firstly can anyone tell me how to get the dtStartDay out of that cell and secondly am I going about this whole thing the right way or is there an easier (more elegant) way to achieve this.![]()
Sub Extract_Date() Dim dtStartDay As Variant Dim dtEndDay As Variant Dim dtMonYear As Variant Dim dtMon As Variant Dim dtYear As Variant Dim dtFullDate As Variant Dim sFile As Variant dtFullDate = Right(Range("A3"), 11) dtMonYear = Right(dtFullDate, 8) dtMon = Left(dtMonYear, 2) dtYear = Right(dtFullDate, 5) dtEndDay = Left(dtFullDate, 2) strMon = MonthName(dtMon) sFile = dtYear & " - " & strMon & " - " & dtEndDay & ".xls" End Sub
Many thanks as always
Seamus
Bookmarks