Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Hi, everyrone:
After confirming that the user is copying from the correct sheet, the following code is trying to copy the entire row containing the active cell, insert a new row at row 5 of the detination sheet, and then paste the copied data into the new row: Sub Copy() ScreenUpdating = False If ActiveSheet.Name = "Status" Then Msg = "You must first select a row on the other sheet to copy and paste." Style = vbOKOnly response = MsgBox(Msg, Style) If response = vbOK Then GoTo 0 End If 0 Else Worksheets("Status").Rows(5).Insert ActiveCell.EntireRow.Copy _ Destination:=Worksheets("Status").Range("5:5") End If ScreenUpdating = True End Sub --Or that's what I want it to do, but I keep getting tripped up on the "insert rows" part near the end. No matter where I put that line of code (either just before or just after the line copying the active row), either I get A) data pasted onto the current line 5 in the destination sheet, (overwriting data that's already there), or I get nothing at all, since in the course of inserting rows, the destination sheet becomes active and the macro seems to be trying to copy THAT now-active row onto itself. Either way--all I really need is for the macro to insert a new row at row 5 of the destination sheet (row 5 because I have head rows over that), and then paste the row from the source sheet into it, pushing all of the existing data down by one row Clearly I've gone horribly wrong. Can anyone help? Sorry to bother everyone, but I've looked through a lot of posts about copy/paste macros, but nothing seems quite to address my problem. |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Copy And Paste Macro Syntax Problem | Excel Worksheet Functions | |||
Copy Paste problem | Excel Discussion (Misc queries) | |||
Copy/Paste Problem | Excel Worksheet Functions | |||
copy paste problem? | Excel Discussion (Misc queries) | |||
Excel cut/Paste Problem: Year changes after data is copy and paste | Excel Discussion (Misc queries) |