[Solved] Somehow it’s not copying [closed]


You need to avoid using Select and Activate.

Set the workbooks, worksheets and ranges to variables and use them.

Also when pasting just values avoid the clipboard for speed.

Sub GetTW_Data()
Dim tWb As Workbook
Dim ebayWb As Workbook
Dim tWs As Worksheet
Dim ebayWs As Worksheet
Dim rng As Range

Set tWb = ThisWorkbook
Set tWs = tWb.Sheets(1)

Set ebayWb = Workbooks.Open(Filename:="C:\Test 1\1 eBay BrandProgress.xls", ReadOnly:=True)
Set ebayWs = ebayWb.Sheets(1)

Set rng = ebayWs.UsedRange

tWs.Range("B5").Resize(rng.Rows.Count, rng.Columns.Count).Value = rng.Value

ebayWb.Close

End Sub

3

solved Somehow it’s not copying [closed]