Hi
I was hoping someone could give me some advice. I have attached an example of what I am trying to achieve.
In sheet 1 I have a set of data. I am trying to extract specific columns from that set of data into a new sheet called "EXTRACT". It works as long as I want to extract data into column A of the "Extract" tab. However soon as I want to extract data into column B or C or any other column it does not.
So for example if we look at the code below, if I change the first paste (Sheet1.Paste Destination:=Worksheets("EXTRACT").Cells(erow, 1)) to another column such as (Sheet1.Paste Destination:=Worksheets("EXTRACT").Cells(erow, 2)) it stops working.
I am sure I am missing something simple so if someone could help me it would be appreciated!
Sub Dump()
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 = Sheet2.Cells(Rows.Count, 1).End(xlUp).Offset(1, 0).Row
Sheet1.Paste Destination:=Worksheets("EXTRACT").Cells(erow, 1)
Sheet1.Cells(i, 3).Copy
Sheet1.Paste Destination:=Worksheets("EXTRACT").Cells(erow, 9)
Sheet1.Cells(i, 6).Copy
Sheet1.Paste Destination:=Worksheets("EXTRACT").Cells(erow, 10)
Next i
Application.CutCopyMode = False
Sheet2.Columns().AutoFit
Range("A1").Select
End Sub
Bookmarks