Solved

Copy text with formatting VBA Excel

Posted on 2011-09-08
4
234 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 31

Expert Comment

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

Thanks
Rob H
0
 
LVL 31

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 31

Expert Comment

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

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

This tutorial explains how to create a series of drop-down lists that are dependent upon prior selections to guide (“force”) the user to make the correct selection and reduce data errors within Microsoft Excel. Excel 2010 was used for this tutorial;…
This article will guide you to convert a grid from a picture into Excel format using Microsoft OneNote and no other 3rd party application.
The viewer will learn how to use the =DISCRINV command to create a discrete random variable, use this command to model a set of probabilities and outcomes in a Monte Carlo simulation, and learn how to find the standard deviation of a set of probabil…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

744 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now