Hi, I am beginner and I am trying to build a code that copies a couple of worksheets into a new workbook. It is working until the line that i mark in red. I am trying to move to WB2 to paste the data and it tries to paste it over WB1.
Sub country_overview()
' country1
'
Dim WB1 As Workbook
Dim WB2 As Workbook
Set WB1 = ThisWorkbook
Cells.Select
Selection.Copy
Workbooks.Add
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Selection.PasteSpecial Paste:=xlPasteFormats, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False
ActiveWindow.Zoom = 70
Sheets("Sheet1").Select
Sheets("Sheet1").Name = "Country"
Sheets.Add After:=ActiveSheet
Sheets("Sheet2").Select
Sheets("Sheet2").Name = "Programs "
Set WB2 = ThisWorkbook
WB1.Activate
Sheets("Current Month").Select
Rows("2:2").Select
Application.CutCopyMode = False
Selection.AutoFilter
Range("C3").Select
ActiveSheet.Range("$A$2:$AD$10000").AutoFilter Field:=3, Criteria1:= _
"Finland"
Cells.Select
Selection.Copy
WB2.Activate
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Selection.PasteSpecial Paste:=xlPasteFormats, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False
Application.CutCopyMode = False
WB1.Activate
End Sub
Sub country_overview()
' country1
'
Dim WB1 As Workbook
Dim WB2 As Workbook
Set WB1 = ThisWorkbook
Cells.Select
Selection.Copy
Workbooks.Add
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Selection.PasteSpecial Paste:=xlPasteFormats, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False
ActiveWindow.Zoom = 70
Sheets("Sheet1").Select
Sheets("Sheet1").Name = "Country"
Sheets.Add After:=ActiveSheet
Sheets("Sheet2").Select
Sheets("Sheet2").Name = "Programs "
Set WB2 = ThisWorkbook
WB1.Activate
Sheets("Current Month").Select
Rows("2:2").Select
Application.CutCopyMode = False
Selection.AutoFilter
Range("C3").Select
ActiveSheet.Range("$A$2:$AD$10000").AutoFilter Field:=3, Criteria1:= _
"Finland"
Cells.Select
Selection.Copy
WB2.Activate
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Selection.PasteSpecial Paste:=xlPasteFormats, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False
Application.CutCopyMode = False
WB1.Activate
End Sub