?
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
Medium Priority
?
428 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
[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
  • 2
4 Comments
 
LVL 49

Accepted Solution

by:
Martin Liss earned 400 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 800 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 800 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 49

Assisted Solution

by:Martin Liss
Martin Liss earned 400 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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

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;…
How to get Spreadsheet Compare 2016 working with the 64 bit version of Office 2016
This Micro Tutorial demonstrate the bugs in Microsoft Excel for Mac with Pivot Charts.
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.

764 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