Cut merged cells

W

Woodi2

I have some code that removes data from one sheet and pastes it to another.
The format has changed since i first created it and now involves merged
cells.
The code below would copy the entire row of the active cell and paste it in
the last row of another sheet, then go back to the original sheet and delete
the now empty row.
My problem is the Active cell is now merged and contains 3 cells. When I
run the code, it only deletes the first row but should include the 2 rows
beneath it as well.

ActiveCell.EntireRow.Copy
Sheets("Backloaded Equipment").Select
Range("B2").End(xlDown).Select
ActiveCell.Offset(1, -1).Select
ActiveSheet.Paste
Sheets("Onboard CPF ").Select
ActiveCell.EntireRow.Delete
 
R

ryguy7272

Oh no!! Merged cells!! I think you are going to have to un-merge those
things before you can do anything significant. I used to use merged cells,
from time to time, but I don't do it any more. Those merged cells cause so
many more problems than they solve.

Maybe someone will come along with an eloquent solution. I's say, un-merge
the cells and then do what you want to do. I can tell that you are already
well acquainted with VBA; you should be able to get it working once those
cells are un-merged.

Good luck,
Ryan---
 
B

Barb Reinhardt

Have you tried

ActiveCell.MergeArea.EntireRow.Delete

FWIW, I also avoid merged cells like the plague.

HTH,
Barb Reinhardt
 
J

JLGWhiz

If you use the top left cell of the merge area you can do it like this.

Sub dk()
Range("B2").MergeArea.EntireRow.Delete
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top