Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 159
Default How to paste data into sheet?

What would be the best way to copy data from one sheet to another where as
the cells of the copy to sheet are merged and not the same size as the copy
from sheet. I have check other posts and they all say to not use merged cells
and they have to be the same size. Is there a way around this?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,718
Default How to paste data into sheet?

Maybe I'm not remembering correctly but I recall this is only a problem when
you do a paste special, values. If that's your problem maybe you can do a
paste special, formulas. Alternatively do a Value = Value (e.g.,
range("A1:A10").Value = range("B1:B10").Value. Alternatively remove the
merged cell, paste, reset merged cell.

--
Jim
"Mekinnik" wrote in message
...
| What would be the best way to copy data from one sheet to another where as
| the cells of the copy to sheet are merged and not the same size as the
copy
| from sheet. I have check other posts and they all say to not use merged
cells
| and they have to be the same size. Is there a way around this?


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 417
Default How to paste data into sheet?

I am assuming that you are copying data from a source data workbook into a
template that happens to have some cells that are merged for some purpose.

Experiment with the MergedCells (Boolean) and MergeArea (Range) properties
of a cell on the "Copy to" worksheet. They will tell you if the destination
cell has been merged with other cells or not. Step through the code below
and inspect the Locals window to see how it works. Check Excel Visual Basic
Help also.

When a cell has been merged with other cells, then you have to use the
MergeArea to copy to, as in the following routine (which assumes both
rngFrom and rngTo are single cells). Basically, the value gets put in the
upper-left corner cell of the rngTo range, and the other cells in the
MergeArea are left empty.

Public Sub CopyToMergedCell(rngFrom As Range, rngTo As Range)
If rngTo.MergeCells _
Then
rngFrom.Copy Destination:=rngTo.MergeArea
Else
rngFrom.Copy Destination:=rngTo
End If
End Sub

--
Regards,
Bill Renaud



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to paste data in new sheet? Mekinnik Excel Programming 0 November 6th 07 07:14 PM
Paste Cells With Data To Another Sheet DoooWhat Excel Discussion (Misc queries) 2 January 31st 07 05:40 PM
Macro to extract data and paste to a new sheet Les Excel Programming 3 August 11th 06 10:10 AM
Copy and paste data to a new sheet bambam77[_10_] Excel Programming 2 August 4th 04 04:32 PM
Automatically Cut Row of Data and Paste to Other Sheet? D[_6_] Excel Programming 2 June 21st 04 11:45 PM


All times are GMT +1. The time now is 07:28 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"