Hi,
Am trying to copy paste of data from one sheet to another sheet but got out of range error. Could any one help me... here i pasted the code
Sub copycolumns()
Dim lastrow As Long, erow As Long
lastrow = Sheet1.Cells(Rows.Count, 1).End(xlUp).Row
For i = 2 To lastrow
Sheet1.Cells(i, 1).Copy
erow = Sheet13.Cells(Rows.Count, 1).End(xlUp).Offset(1, 0).Row
Sheet1.Paste Destination = Worksheets("Sheet13").Cells(erow, 1)
Sheet1.Cells(i, 2).Copy
Sheet1.Paste Destination = Worksheets("Sheet13").Cells(erow, 2)
Sheet1.Cells(i, 3).Copy
Sheet1.Paste Destination = Worksheets("Sheet13").Cells(erow, 3)
Sheet1.Cells(i, 4).Copy
Sheet1.Paste Destination = Worksheets("Sheet13").Cells(erow, 4)
Sheet1.Cells(i, 5).Copy
Sheet1.Paste Destination = Worksheets("Sheet13").Cells(erow, 5)
Sheet1.Cells(i, 6).Copy
Sheet1.Paste Destination = Worksheets("Sheet13").Cells(erow, 6)
Sheet1.Cells(i, 7).Copy
Sheet1.Paste Destination = Worksheets("Sheet13").Cells(erow, 7)
Sheet1.Cells(i, 8).Copy
Sheet1.Paste Destination = Worksheets("Sheet13").Cells(erow, 8)
Sheet1.Cells(i, 9).Copy
Sheet1.Paste Destination = Worksheets("Sheet13").Cells(erow, 9)
Sheet1.Cells(i, 10).Copy
Sheet1.Paste Destination = Worksheets("Sheet13").Cells(erow, 10)
Next i
Application.CutCopyMode = False
Sheet13.Columns().AutoFit
Range("A1").Select
End Sub
Thanks
JK
Bookmarks