PDA

View Full Version : Solved: File saving challenge



jacksonworld
02-17-2008, 08:47 PM
Hi, I have an Excel challenge which I am spectularly failing to conquer.

I am also having great difficulty explaining the issue, so please bear with me. I hope someone will be kind enough to assist.


I have a series of cells, some of which are populated with dates; others of which are blank.

I am attempting to create a sub that will save the file, naming it according to the first non-blank value in the series - ie. a date.

To make it difficult, the date format in the cell is different from the filename date format.

I have attached a simple spreadsheet, as I realise my explanation is vague at best.

Thanks

Bob Phillips
02-18-2008, 01:51 AM
Sub SaveFile()
Dim mpDate As Long

With ActiveSheet

mpDate = .Evaluate("=MIN(IF((MOD(ROW(A1:A1000),3)=0)*(A1:A1000<>""""),ROW(A1:A1000)))")
If mpDate <> 0 Then

ThisWorkbook.SaveAs "C:\Folder\" & Format(.Range("A1:A1000").Cells(mpDate, 1), "yyyy-mm-dd")
End If
End With
End Sub

jacksonworld
02-18-2008, 02:25 AM
Brilliant. Thank you very much, xld.

You saved the day once again. :bow: