Wrox Programmer Forums
|
Excel VBA Discuss using VBA for Excel programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Excel VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 18th, 2004, 06:15 AM
Authorized User
 
Join Date: Oct 2004
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
Default Copying Cell Formats

Is there a quick means in VBA to copy a range of cells from one sheet to another including all of its formatting properties such as colour, font, borders?

 
Old October 18th, 2004, 08:25 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 150
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Try this:

    Selection.Copy
    Sheets("Sheet2").Select
    Range("A1").Select
    ActiveSheet.Paste

..or use the MacroRecorder in the Functions Menu to get the code.
 
Old October 18th, 2004, 11:13 AM
Authorized User
 
Join Date: Oct 2004
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thank you.

For some reason I thought this would only copy the value, but I see it copies the format as well.

 
Old October 18th, 2004, 11:23 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 150
Thanks: 0
Thanked 0 Times in 0 Posts
Default

You're welcome!

I guess you was thinking of 'Paste Special' from the Edit menu where you can de-/select different formats.





Similar Threads
Thread Thread Starter Forum Replies Last Post
difference between these three formats rajesh_css XSLT 5 October 22nd, 2008 03:26 AM
Date Formats carumuga SQL Server 2000 4 January 2nd, 2007 07:20 PM
if the cell content is a part of another cell cont sriramus Excel VBA 1 November 15th, 2005 10:20 AM
About Message formats abdul_owiusa C# 3 August 10th, 2004 12:46 PM
Lose cell Text when editing cell in VSFlexGrid 6 bobcratchet VB How-To 0 July 30th, 2004 09:32 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.