Johnpants
11-22-2005, 03:49 AM
Hi, I have written this code to copy a cell from one sheet, then paste it into the next free row on another, but for some reason it pastes it to row 58, and if I do it again, rather than pasting to the next row it just pastes over the top of the last one..
Could anyone tell me where i'm going wrong please?
Thanks.
Private Sub CommandButton1_Click()
LastRow = Range("A65536").End(xlUp).Row
Sheets("Order").Range("A22").copy
Sheets("Data").Select
Cells(LastRow + 1, 1).Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
Sheets("Order").Range("A24").copy
Sheets("Data").Select
Cells(LastRow + 1, 2).Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
Sheets("Order").Range("A26").copy
Sheets("Data").Select
Cells(LastRow + 1, 3).Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
Unload Me
End Sub
Could anyone tell me where i'm going wrong please?
Thanks.
Private Sub CommandButton1_Click()
LastRow = Range("A65536").End(xlUp).Row
Sheets("Order").Range("A22").copy
Sheets("Data").Select
Cells(LastRow + 1, 1).Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
Sheets("Order").Range("A24").copy
Sheets("Data").Select
Cells(LastRow + 1, 2).Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
Sheets("Order").Range("A26").copy
Sheets("Data").Select
Cells(LastRow + 1, 3).Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
Unload Me
End Sub