Skip to main content
Support is Online
We're back! We are here to assist you. Please be patient, we will respond to your tickets shortly.
Official support hours
Monday To Friday
From 09:00 To 17:30
  Tuesday, 30 January 2018
  0 Replies
  1.4K Visits
0
Votes
Undo
I am hoping someone can help me solve a puzzle here. I have a workbook with a number of tabs for which I have created macro to save each of these as it's own VBA file. When the files are saved the macro is designed to use the name of the tab combined with a predefined value and a date and time.

Here is my issue. I have only single tab that I wish to exclude, as it needs a different naming convention but I cannot figure out how to exclude it from the macro I have and then get the same macro to save that file with a different naming convention.

Here is what I have:

Public Sub SaveWorksheetsAsCsv222()
Dim xWs As Worksheet
Dim xDir As String
Dim folder As FileDialog
dt = Format(CStr(Now), "YYYYMMDDHHMM")
Set folder = Application.FileDialog(msoFileDialogFolderPicker)
If folder.Show <> -1 Then Exit Sub
xDir = folder.SelectedItems(1)
For Each xWs In Application.ActiveWorkbook.Worksheets
xWs.SaveAs xDir & "\" & "US_DGF_" & xWs.Name & "_CARe_" & dt, xlCSV, Local:=True
Next
End Sub

What I need is for a tab named USCS to be saved using the same criteria but instead of "CARe: it needs to be CARe2 - Just this tab only.

Can anyone help please?
There are no replies made for this post yet.