copy paste merged cells

I

Ivano

Hi,
The following code gives me "cannot change part of a merged cell" because
each of the rows (H to K) that I am copy/pasting are merged. I have tried
just to use H5:H23 as the range but that didn't work either. Can someone
suggest something?

I have the following code:

Public Sub Sheet1()
Dim srcWb As Workbook
Dim destWb As Workbook
Dim srcSH As Worksheet
Dim destSH As Worksheet
Dim srcRng As Range
Dim destRng As Range

Set srcWb = Workbooks("Source Workbook.xls")
Set destWb = Workbooks("Destination Workbook.xls")
Set srcSH = srcWb.Sheets("Source Worksheet")
Set destSH = destWb.Sheets("Destination Worksheet")

srcSH.Range("H5:K23").Copy Destination:=destSH.Range("H5:K23")

End Sub

Thanks,
Ivano
 

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