Macro deletes top line copied data


Posted by Dave on February 21, 2001 2:18 PM

I know I'm missing a command line to move the copied data down one row & then paste it. I just can't find the command. Any help?

This is the macro


Sub MoveSalesData()
'
' MoveSalesData Macro
' Macro recorded 2/19/2001 by Dave
'
' Keyboard Shortcut: Ctrl+m
'
Application.Goto Reference:="R3C1"
Range(Selection, Selection.End(xlDown)).Select
Range(Selection, Selection.End(xlToRight)).Select
Selection.Copy
Sheets("Sheet2").Select
Application.Goto Reference:="R4004C1"
Selection.End(xlUp).Select
ActiveSheet.Paste
Sheets("Sheet1").Select
Application.CutCopyMode = False
Selection.ClearContents
Range("A3").Select
End Sub

Posted by David Hawley on February 21, 2001 10:13 PM

MoveSalesData Macro Macro recorded 2/19/2001 by Dave Keyboard Shortcut: Ctrl+m

Dave, I'm not sure what you mean, but try this code:

Sub MoveSalesData()
Dim MyRange As Range

Set MyRange = _
Range(Range("A3"), Range("A3").End(xlDown).End(xlToRight))

MyRange.Copy Destination:=Sheets("Sheet2").Range("A400").End(xlUp)

Application.CutCopyMode = False

MyRange.Clear

End Sub


Dave

OzGrid Business Applications



Posted by Celia on February 22, 2001 12:03 AM

Dave (i.e. Dave, the original poster)
Do you mean that you want the paste destination cell to be one row lower?
If so, then revise DH's code to :-
MyRange.Copy Destination:=Sheets("Sheet2").Range("A400").End(xlUp).Offset(1,0)
Celia