Copy paste to merged cells

cknnugget

Board Regular
Joined
Jun 29, 2020
Messages
50
Office Version
  1. 365
Platform
  1. Windows
Trying to make a macro that will loop through a table to fill cells on another sheet. When the code gets to merged cells, it errors. I tried paste special but it does not work.
How do you paste to a merged cell in this instance?
Receipt Macro
Dim cell As Range
For Each cell In Range("MEMOLog[Delivered Date]")
If cell.Value = "x" Then
cell.Offset(0, 2).Copy Destination:=(Sheets("test").Range("B8"))
cell.Offset(0, 1).Copy Destination:=(Sheets("test").Range("D8"))
cell.Offset(0, 3).Copy Destination:=(Sheets("test").Range("D9"))
cell.Offset(0, 7).Copy Destination:=(Sheets("test").Range("B10"))
'Paste special not working
cell.Offset(0, 4).Copy Sheets("test").Range("A13").Pastespecial Paste = xlPasteFormulas
cell.Offset(0, 5).Copy Destination:=(Sheets("test").Range("C13"))
cell.Offset(0, 6).Copy Destination:=(Sheets("test").Range("D14"))
Sheets("test").PrintOut
 

Excel Facts

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.
Try this:

VBA Code:
    cell.Offset(0, 4).Copy
    Sheets("test").Range("A13").MergeArea.PasteSpecial Paste = xlPasteFormulas

This should work too:
VBA Code:
Sheets("test").Range("A13").Formula = cell.Offset(0, 4).Formula
 
Upvote 0

Forum statistics

Threads
1,223,885
Messages
6,175,179
Members
452,615
Latest member
bogeys2birdies

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