Automatically move entire rows from one worksheet into another worksheet in the same workbook - please see the code that I used and explain why i have

brandidk

New Member
Joined
Jan 31, 2016
Messages
19
Good morning, I have an excel workbook that has two tabs. one is 2015 and the other is Shipping. Both sheets are identical. I have added a code in column Y (date shipped) and have received a Run-time error of "1004' - we can not do that to a merged cell. Please advise what I need to change in order for this to work. Please see the code below - the BOLD line is the error line.

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
If Not Intersect(Target, Range("Y:Y")) Is Nothing Then
Cancel = True
Dim Lastrow As Long
Lastrow = Sheets("Shipped").Cells(Rows.Count, "Y").End(xlUp).Row + 1
Rows(Target.Row).Cut Destination:=Sheets("Shipped").Rows(Lastrow)
Rows(ActiveCell.Row).EntireRow.Delete
End If
End Sub
 
The cells are merged because the report has other cells that have dimensions in inches and then in cm and weight in lbs and kgs. In order for the report to be easy to print and read that was how we set it up. To merge the other cells together so that they are in the center of the row. We require all the information to go from the first tab to the second tab without having to cut and paste and delete the lines.
 
Upvote 0

Excel Facts

Lock one reference in a formula
Need 1 part of a formula to always point to the same range? use $ signs: $V$2:$Z$99 will always point to V2:Z99, even after copying

Forum statistics

Threads
1,216,052
Messages
6,128,509
Members
449,455
Latest member
jesski

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top