Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Copy text with formatting VBA Excel

Posted on 2011-09-08
4
Medium Priority
?
247 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
[X]
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
  • 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 2000 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: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

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

When you see single cell contains number and text, and you have to get any date out of it seems like cracking our heads.
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
The viewer will learn how to create a normally distributed random variable in Excel, use a normal distribution to simulate the return on an investment over a period of years, Create a Monte Carlo simulation using a normal random variable, and calcul…
This Micro Tutorial will demonstrate on a Mac how to change the sort order for chart legend values and decrpyt the intimidating chart menu.

609 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