Solved

with excel vba how can I transfer the text in one cell to another with losing all the formatting

Posted on 2013-06-25
4
387 Views
Last Modified: 2013-06-26
I have highly formatted cells which I want to transfer to other cells progrommaticly with vba
how do I do this without losing formatting?
0
Comment
Question by:Dov_B
  • 2
4 Comments
 
LVL 46

Accepted Solution

by:
Martin Liss earned 100 total points
ID: 39274792
To copy both values and formatting do something like this.

    Selection.Copy
    Range("A3").PasteSpecial Paste:=xlPasteAllUsingSourceTheme, Operation:=xlNone _
        , SkipBlanks:=False, Transpose:=False
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
0
 
LVL 20

Assisted Solution

by:dsacker
dsacker earned 200 total points
ID: 39274793
This is an example. You can change out the "Range" for "Cells", if you are looping through columns or rows, and use the same methods.
Public Sub TestThis()
    ' Have a specially formatted value in D5, and move it to F5
    Range("D5").Select
    Selection.Copy
    Range("F5").Select
    ActiveSheet.Paste
    Application.CutCopyMode = False

    ' If you need to clear the formatting in your source, do this.
    Range("D5").Clear
End Sub

Open in new window

0
 
LVL 13

Assisted Solution

by:Shanan212
Shanan212 earned 200 total points
ID: 39274796
    Range("H14").Select
    Selection.Copy
    Range("J14").Select
    ActiveSheet.Paste
application.cutcopymode=false

Open in new window


Considering you want to copy from H14 to J14
0
 
LVL 46

Assisted Solution

by:Martin Liss
Martin Liss earned 100 total points
ID: 39274798
And in my example if you just want to copy the formatting do just the first of the two PasteSpecials.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Introduction This Article is a follow-up to my Mappit! Addin Article (http://www.experts-exchange.com/A_2613.html), it was inspired by an email posting I made to EUSPRIG (http://www.eusprig.org/index.htm), I will briefly cover: 1) An overvie…
How to quickly and accurately populate Word documents with Excel data, charts and images (including Automated Bookmark generation) David Miller (dlmille) Synopsis In this article you’ll learn how to use ExcelToWord! to copy data,charts, shapes …
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 demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.

911 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

21 Experts available now in Live!

Get 1:1 Help Now