+ Reply to Thread
Results 1 to 2 of 2

Save as CSV to specific folder on desktop and current date as filename

  1. #1
    Registered User
    Join Date
    09-12-2012
    Location
    United Kingdom
    MS-Off Ver
    Excel 2007
    Posts
    9

    Save as CSV to specific folder on desktop and current date as filename

    Hi,

    I currently have a macro to delete a row if a certain value is 0 and then brings up the save as CSV to save as any required file name.

    I was wondering if it was possible to advance this further by also saving it into a folder on the desktop and the file name being the date the macro was run.

    This is the macro that currently works perfectly.

    Sub ReduceRowsAndSave()
    Dim strFileName As String, LR As Long

    strFileName = Application.GetSaveAsFilename(filefilter:="Comma Seperated Values (*.csv), *.csv")
    If strFileName = "False" Then Exit Sub

    Sheets("RoyalMail").Copy
    ActiveSheet.AutoFilterMode = False
    Rows(1).AutoFilter
    Rows(1).AutoFilter 5, 0
    LR = Range("E" & Rows.Count).End(xlUp).Row
    If LR > 1 Then Range("A2:A" & LR).EntireRow.Delete xlShiftUp
    ActiveSheet.AutoFilterMode = False

    ActiveWorkbook.SaveAs strFileName, xlCSV
    ActiveWindow.Close False

    End Sub

    Any help would be much appreciated.

    Thanks
    James

  2. #2
    Forum Contributor
    Join Date
    11-25-2010
    Location
    Glasgow, Scotland
    MS-Off Ver
    Excel 2007
    Posts
    120

    Re: Save as CSV to specific folder on desktop and current date as filename

    Hi James,

    Think this is what you are after:

    Please Login or Register  to view this content.
    Just change the strFolderName to the desktop location.
    If the post was helpful please click the black star on the bottom left to add some reputation and mark your thread as SOLVED.

    A day with nothing new achieved or learned, albeit however small, is a day lost forever?

    Constant Never Ending Improvement

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1