Hi I am completely to new VBA. I was trying create a button, which can automatically copy data from columns A-E on sheet1("Overview") to Sheet2 ("Example").
Below is the code I have copied from a tutorial video, but it ends up with an error 424 message--Object Required.
And the problem seems is with the lastrow: lastrow = Sheetoverview.Cells(Rows.Count, 1).End(xlUp).Row
Can anyone please help me with this problem? Thank you!
Sub copyconlumns()
Dim lastrow As Long, erow As Long
lastrow = Sheetoverview.Cells(Rows.Count, 1).End(xlUp).Row
For i = 2 To lastrow
Sheetoverview.Cells(i, 1).copy
erow = sheetexample.Cells(Tows.Count, 1).End(xlUp).Offset(1, 0).Row
Sheetoverview.Paste Destination = Worksheets("Sheetexample").Cells(erow, 1)
Sheetoverview.Cells(i, 2).copy
Sheetoverview.Paste Destination = Worksheets("Sheetexample").Cells(erow, 2)
Sheetoverview.Cells(i, 3).copy
Sheetoverview.Paste Destination = Worksheets("Sheetexample").Cells(erow, 3)
Sheetoverview.Cells(i, 4).copy
Sheetoverview.Paste Destination = Worksheets("Sheetexample").Cells(erow, 4)
Sheetoverview.Cells(i, 5).copy
Sheetoverview.Paste Destination = Worksheets("Sheetexample").Cells(erow, 5)
Next i
Application.CutCopyMode = False
sheetexample.Columns.AutoFit
Range("A1").Select
End Sub