title: Automatically save certain sheets in workbook to CSV file
body: <p>I have found a decent solution <a href="https://stackoverflow.com/questions/10551353/saving-excel-worksheet-to-csv-files-with-filenameworksheet-name-using-vb">Saving excel worksheet to CSV files with filename+worksheet name using VB</a> for saving all worksheets in a workbook as CSV files. However, I would like to be able to modify this code to only save worksheets where the sheet name ends with <code>_t</code>.</p>
  
  <p>I am using the following code:</p>
  
  <pre><code>Sub SaveWorksheetsAsCsv()
  
  Dim WS As Excel.Worksheet
  Dim SaveToDirectory As String
  
  Dim CurrentWorkbook As String
  Dim CurrentFormat As Long
  
  CurrentWorkbook = ThisWorkbook.FullName
  CurrentFormat = ThisWorkbook.FileFormat
  ' Store current details for the workbook
  SaveToDirectory = "H:\test\"
  For Each WS In ThisWorkbook.Worksheets
      Sheets(WS.Name).Copy
      ActiveWorkbook.SaveAs Filename:=SaveToDirectory &amp; ThisWorkbook.Name &amp; "-" &amp; WS.Name &amp; ".csv", FileFormat:=xlCSV
      ActiveWorkbook.Close savechanges:=False
      ThisWorkbook.Activate
  Next
  
  Application.DisplayAlerts = False
  ThisWorkbook.SaveAs Filename:=CurrentWorkbook, FileFormat:=CurrentFormat
  Application.DisplayAlerts = True
  ' Temporarily turn alerts off to prevent the user being prompted
  '  about overwriting the original file.
  
  End Sub
  </code></pre>
  
  <p>Can this be done?</p>