Excel VBA select method of range class failed
问题 I am trying to copy ranges of data from various worksheets into one worksheet. I have written this code: Sub sub1() For i = 1 To 3 Sheets(i).Select Range(Cells(1, 1), Cells(1, 1).End(xlDown)).Select 'line4 Selection.Copy Sheets(6).Select Cells(1, i).Select Selection.PasteSpecial xlPasteValues Next i End sub I get a Run-time error '1004' Select method of Range class failed on the line 4. How can it be fixed? 回答1: You don't Select a sheet you Activate it. But actually you shouldn't do either in