Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Copy text with formatting VBA Excel

Posted on 2011-09-08
4
238 Views
Last Modified: 2012-06-27
I am importing info from one sheet to another.
The FromSheet has a block of megered cells with text inside. The text is fomatted with some portions in BOLD.
The NewSheet has a similar merged cell arrangement

This Code:

newSheet(destination)=fromSheet(source)

copies text just fine, but loses BOLD formatting.
I have tried

FromSheet(source).copy newSheet(destination)

And

FromSheet(source).copy
newSheet(destination).PasteSpecial

But they both error "cannot change merged cell"

Any ideas????


 

0
Comment
Question by:Grizzler
  • 3
4 Comments
 
LVL 33

Expert Comment

by:Rob Henson
ID: 36504781
Try doing Activesheet.Paste rather than PasteSpecial.

Thanks
Rob H
0
 
LVL 33

Accepted Solution

by:
Rob Henson earned 500 total points
ID: 36504790
Or select destination and clear all formatting, thus splitting the merged cells and then paste. The merged format should copy over as well.

Thanks
Rob H
0
 

Author Closing Comment

by:Grizzler
ID: 36505483
A closer look at the sheets (created by someone else) revealed the source and destination were differrent sizes.... That caused the cannot change merged cell error. I went with your second suggestion and unmerged destination and used this code
impSheet.Range("C23:K28").Copy mySheet.Range("D25:L30")
Works great!
0
 
LVL 33

Expert Comment

by:Rob Henson
ID: 36506843
Glad to of help
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction While answering a recent question (http:/Q_27311462.html), I created an alternative function to the Excel Concatenate() function that you might find useful.  I tested several solutions and share the results in this article as well as t…
Excel can be a tricky bit of software to get your head around. Whilst you’ll be able to eventually get to grips with the basic understanding of how to get by, there are a few Excel tips that not everybody will even know about let alone know how to d…
This Micro Tutorial demonstrate the bugs in Microsoft Excel for Mac with Pivot Charts.
This Micro Tutorial will demonstrate in Google Sheets how to use the HYPERLINK function to create live links inside your spreadsheet.

828 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question