1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73
| Sub ERCompleteProcess()
Dim ShortCountry As String
Dim Country As String
Dim ERCountry As String
Dim Template As String
Dim OutputFile As String
Dim OutputFileName As String
Dim Manf As String
Dim ManfShort As String
' Create sheet per country
OutputFileName = Range("F21")
Template = ActiveWorkbook.Name
Workbooks.Open Filename:= _
"O:\Final value file.xls"
OutputFile = ActiveWorkbook.Name
Windows(Template).Activate
Sheets("Start Page").Select
Range("D38").Select
Set DataRange = ActiveSheet.Range(Selection, Selection.End(xlDown))
For Each c In DataRange
c.Select
Country = ActiveCell
ShortCountry = ActiveCell.Offset(0, 2)
ERCountry = ActiveCell.Offset(0, 3)
' Put TM1 to current country
Range("f18") = Country
' Put ER country name
Sheets("Output").Select
Range("A11") = ERCountry
' Process for current country
Call ERCountryProcess
' Copy and paste the output sheet in final output file
Workbooks(Template).Sheets("Output").Select
Workbooks(Template).Sheets("Output").Copy After:=Workbooks(OutputFile).Sheets(Workbooks(OutputFile).Sheets.Count)
' Value copy and Renaming the output sheet with country name
Cells.Select
Range("AA48").Activate
Selection.Copy
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False
Sheets("Output").Select
Sheets("Output").Name = ShortCountry
Range("P14").Select
Application.CutCopyMode = False
Windows(Template).Activate
Sheets("Start Page").Select
Next
Windows(OutputFile).Activate
ActiveWorkbook.SaveAs Filename:="O:\" & OutputFileName & ".xls"
End Sub |
Partager