ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Error €śThis operation requires the merged cells to be identically (https://www.excelbanter.com/excel-programming/347161-error-%E2%80%9C-operation-requires-merged-cells-identically.html)

ca1358

Error €śThis operation requires the merged cells to be identically
 
I have (A) spreadsheet that has a template with 3 merged cells,

So I made a 2nd (B) spreadsheet with same template.

Set up code to copy a line from (A) and paste to (B) but I get an error

€śThis operation requires the merged cells to be identically sized.€ť .

Both sheets are identical. Can someone tell me how to get around this?


--
ca1358

Alok

Error €śThis operation requires the merged cells to be identically
 
Can you please submit the code you are using?

Alok

"ca1358" wrote:

I have (A) spreadsheet that has a template with 3 merged cells,

So I made a 2nd (B) spreadsheet with same template.

Set up code to copy a line from (A) and paste to (B) but I get an error

€śThis operation requires the merged cells to be identically sized.€ť .

Both sheets are identical. Can someone tell me how to get around this?


--
ca1358


ca1358

Error €śThis operation requires the merged cells to be identica
 
It stops at this line in the sub and gives me the error.
rngToPaste.PasteSpecial xlPasteValues


Private Sub cmdGN15Data1_Click()
Dim rngToCopy As Range
Dim rngToPaste As Range
Dim wksToPaste As Worksheet

Set rngToCopy = Sheets("GN15").Range("A28:v28")
Set wksToPaste = Sheets("TempTable")
Set rngToPaste = wksToPaste.Cells(Rows.Count, _
"A").End(xlUp).Offset(1, 0)

rngToCopy.Copy
wksToPaste.Unprotect "Cubs1908"
rngToPaste.PasteSpecial xlPasteValues
wksToPaste.Protect "Cubs1908"

Application.CutCopyMode = False
--
ca1358


"Alok" wrote:

Can you please submit the code you are using?

Alok

"ca1358" wrote:

I have (A) spreadsheet that has a template with 3 merged cells,

So I made a 2nd (B) spreadsheet with same template.

Set up code to copy a line from (A) and paste to (B) but I get an error

€śThis operation requires the merged cells to be identically sized.€ť .

Both sheets are identical. Can someone tell me how to get around this?


--
ca1358


Tom Ogilvy

Error "This operation requires the merged cells to be identica
 
Try changing it to:

' rngToCopy.Copy
wksToPaste.Unprotect "Cubs1908"
rngToPaste.Resize(rngTocopy.Rows.count, _
rngToCopy.columns.count).Value = rngTocopy
wksToPaste.Protect "Cubs1908"

--
Regards,
Tom Ogilvy

"ca1358" wrote in message
...
It stops at this line in the sub and gives me the error.
rngToPaste.PasteSpecial xlPasteValues


Private Sub cmdGN15Data1_Click()
Dim rngToCopy As Range
Dim rngToPaste As Range
Dim wksToPaste As Worksheet

Set rngToCopy = Sheets("GN15").Range("A28:v28")
Set wksToPaste = Sheets("TempTable")
Set rngToPaste = wksToPaste.Cells(Rows.Count, _
"A").End(xlUp).Offset(1, 0)

rngToCopy.Copy
wksToPaste.Unprotect "Cubs1908"
rngToPaste.PasteSpecial xlPasteValues
wksToPaste.Protect "Cubs1908"

Application.CutCopyMode = False
--
ca1358


"Alok" wrote:

Can you please submit the code you are using?

Alok

"ca1358" wrote:

I have (A) spreadsheet that has a template with 3 merged cells,

So I made a 2nd (B) spreadsheet with same template.

Set up code to copy a line from (A) and paste to (B) but I get an

error

"This operation requires the merged cells to be identically sized." .

Both sheets are identical. Can someone tell me how to get around this?


--
ca1358





All times are GMT +1. The time now is 05:28 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com