xzy
xzy

Reputation: 1

Copying and Pasting a Range of Cells from One Worksheet to Another Worksheet

I am trying to copy a range of cells from one worksheet (Sheet2) to a different range of cells in another worksheet (Sheet1) but when I run the below, I get a run time error (1004) application defined or object defined error. Any help is appreciated!

Option Explicit

Sub deletecolumns()

Workbooks(1).Worksheets(1).Columns(2).Select
Workbooks(1).Worksheets(1).Columns(2).Delete


Sheets("Sheet2").Range("I4:I29").Copy Destination:=Sheets("Sheet1").Range("H4:H29")

End Sub

Upvotes: 0

Views: 234

Answers (1)

FreeMan
FreeMan

Reputation: 5687

delete this line:

Workbooks(1).Worksheets(1).Columns(2).Select

there's no need for it before doing a .delete anyway

Upvotes: 1

Related Questions