Forum

Notifications
Clear all

Copy & Paste with Merged Cells Above and Below

3 Posts
2 Users
0 Reactions
155 Views
(@Anonymous)
Posts: 0
New Member Guest
 

Hello

I am wanting to copy and paste a range per the script below. None of the cells I am copying & pasting from/to are merged. 

Sheet4.Range("N6:U7").Copy Range("L6:S7")
Sheet4.Range("N9:U10").Copy Range("L9:S10")
Sheet4.Range("N12:U12").Copy Range("L12:S12")

The first line works but the macro stops on the second line and gives the following run-time error:

run-time error '1004'

We can't do that to a merged cell.

 

To get past this, I enter into cells N9:S10 and re-run the macro which then works. 

Can someone please tell me how to get around this error without unmerging the cells above and below? 

 
Posted : 18/09/2018 6:37 pm
(@Anonymous)
Posts: 0
New Member Guest
 

I needed to include the sheet number between copy and range.  Then it works.

Sheet4.Range("N6:U7").Copy Sheet4.Range("L6:S7")

 
Posted : 18/09/2018 9:25 pm
Philip Treacy
(@philipt)
Posts: 1629
Member Admin
 

Thanks for letting us know you worked this out.

Phil

 
Posted : 25/09/2018 12:50 am
Share: