I am trying to write the macros but having difficulties. Every month I get a file for which I have to perform specific tasks of copying data and paste as values and to delete specific sheets. But the main part is as every month the file name will be changing so I am trying to put these macros into another blank workbook which will open the particular workbook and does the task and after completing the tasks it will save this file as a new excel file. Nomefile is a cell which contains the name of the workbook which needs to be opened.
Sub PasteSpecial_Values()
nomefile = (dati(j, 1) & "\" & dati(j, 2))
Workbooks.Open Filename:=nomefile
Worksheets("SC Global Overview").Range("A1:F80").Copy
Worksheets("SC Global Overview").Range("A1:F80").PasteSpecial Paste:=xlPasteValues
Worksheets("GL_EU").Range("A1:J100").Copy
Worksheets("GL_EU").Range("A1:J100").PasteSpecial Paste:=xlPasteValues
Worksheets("GL_APAC").Range("A1:J100").Copy
Worksheets("GL_APAC").Range("A1:J100").PasteSpecial Paste:=xlPasteValues
Worksheets("GL_SAM & NAM").Range("A1:J100").Copy
Worksheets("GL_SAM & NAM").Range("A1:J100").PasteSpecial Paste:=xlPasteValues
Worksheets("SC Europe Overview").Range("A1:F80").Copy
Worksheets("SC Europe Overview").Range("A1:F80").PasteSpecial Paste:=xlPasteValues
Worksheets("REG_EU").Range("A1:J100").Copy
Worksheets("REG_EU").Range("A1:J100").PasteSpecial Paste:=xlPasteValues
Application.CutCopyMode = False
End Sub
Sub SheetKiller()
Dim s As Worksheet, t As String
Dim i As Long, K As Long
K = Sheets.Count
For i = K To 1 Step -1
t = Sheets(i).Name
If t = "Check combinations" Or t = "Measures" Or t = "GL_Target" Or t = "Parameters" Or t = "Data" Or t = "Pivot data initiative" Or t = "Pivot data substream" Or t = "Pivot data" Or t = "Pivot check names" Or t = "Pivot check region" Then
Application.DisplayAlerts = False
Sheets(i).Delete
Application.DisplayAlerts = True
End If
Next i
ThisWorkbook.SaveAs Filename:=WaveReporting, Format:=xlOpenXMLWorkbook
End Sub
Can someone please help and it will be good if we can convert it to one macro rather than 2?
Regards.