Hi there,
I'm new to VBA and am struggling to convert the following working script from exporting tabs that contain a specified key word to export similar range names instead:
Sub CreateCSV()
Application.ScreenUpdating = False
Application.DisplayAlerts = False
'-----------------------------
'DECLARE AND SET VARIABLES
Dim wb1 As Workbook, ws1 As Worksheet
Dim wbname As String, I As Integer
Set wb1 = ThisWorkbook
'-----------------------------
'CYCLE THROUGH SHEETS AND MATCH UPLOAD
For I = 1 To Worksheets.Count
wbname = Worksheets(I).Name
If InStr(1, Ucase(Worksheets(I).Name), "UPLOAD", vbTextCompare) > 0 Then
'-----------------------------
'COPY SHEET INTO NEW CSV FILE
Worksheets(I).Copy
ActiveWorkbook.SaveAs Filename:="C:\Users\Maudibe\Documents\" & wbname & ".csv", _
FileFormat:=xlCSV, CreateBackup:=False
ActiveWorkbook.Close
wb1.Activate
End If
Next I
'-----------------------------
'CLEANUP
Application.DisplayAlerts = True
Application.ScreenUpdating = True
End Sub
Any pointers gratefully received.
Thanks,
John
Bookmarks