Hello, please correct the following code. I can't copy data from certain papers except the main one
VBA Code:
Sub copy()
Dim last As Long, lr As Long
Dim sh As Worksheet: Set sh = Sheet1
Dim WSname As String
With Sheet1
last = .Range("A" & Rows.Count).End(xlUp).Row
End With
Dim ArrayOne As Variant
ArrayOne = Array("Sheet3", "Sheet8")
lr = Range("a" & Rows.Count).End(xlUp).Row
With Sheets(ArrayOne)
.Range("A2:G" & lr).AdvancedFilter Action:=xlFilterCopy, CopyToRange:=sh.Range("A" & last + 2)
sh.Range("i" & last + 2).Value = WSname
End With
End Sub