mohan
03-04-2008, 07:32 PM
i'm having a very tiresoem problem at the momment.
I want to copy the range from column "p" from "sheet1"
to cell "d8" in "sheet2"
the thing is though that the number of rows in "p" can change, ie
there can by 5 rows of data, or 100 rows of data
this is what i've come up with, but it only takes the last cell and copies it?...
many thanks in advance.
Private Sub CommandButton5_Click()
Dim frows As Double
Dim i As Double
Worksheets("sheet1").Select
frows = Cells(rows.Count, 5).End(xlUp).Row
Range("e" & frows).Select
Selection.Copy
Worksheets("sheet2").Select
For i = 1 To frows
Cells(i, 10).Select
ActiveSheet.Paste
Next i
End Sub
I want to copy the range from column "p" from "sheet1"
to cell "d8" in "sheet2"
the thing is though that the number of rows in "p" can change, ie
there can by 5 rows of data, or 100 rows of data
this is what i've come up with, but it only takes the last cell and copies it?...
many thanks in advance.
Private Sub CommandButton5_Click()
Dim frows As Double
Dim i As Double
Worksheets("sheet1").Select
frows = Cells(rows.Count, 5).End(xlUp).Row
Range("e" & frows).Select
Selection.Copy
Worksheets("sheet2").Select
For i = 1 To frows
Cells(i, 10).Select
ActiveSheet.Paste
Next i
End Sub