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 August 23rd, 2005, 01:28 AM
ct ct is offline
Authorized User
 
Join Date: Aug 2005
Posts: 28
Thanks: 0
Thanked 0 Times in 0 Posts
Default copy value in VB

ii..i have a problem to copy the value..for the example...in "sheet1" in column "A1" have value=2 and at the same time the column in "A1" have a formula "=Sheet2!A1"....how i want to copy the value from column "A1" to column "A5" in the same sheet"Sheet1"... i can't use this coding...

With Worksheets("Sheet1")
    .Range("A1").Copy
    .Range("A5").PasteSpecial _
        Operation:=xlPasteSpecialOperationAdd
End With

this coding doesn't work in this situation...it is because the value in A1 have a formula....can u help me solve this problem..tq very much


 
Old August 23rd, 2005, 02:38 AM
Friend of Wrox
 
Join Date: Jan 2005
Posts: 180
Thanks: 0
Thanked 0 Times in 0 Posts
Default

replace your last line of code with the following.

.Range("A5").PasteSpecial Paste:=xlValues, Operation:=xlAdd

cheers

Matt






Similar Threads
Thread Thread Starter Forum Replies Last Post
How to Copy a File using VB 2005? phenom BOOK: Beginning Visual Basic 2005 ISBN: 978-0-7645-7401-6 11 July 31st, 2008 01:23 AM
Copy DataSet prasanta2expert ASP.NET 1.0 and 1.1 Professional 1 January 22nd, 2007 09:30 AM
Copy excel macros to vb project battlebob Excel VBA 2 November 9th, 2004 10:13 AM
Copy to Clipboard Clive Astley Access 5 July 16th, 2004 07:16 PM
Copy word to word doc. in VB vamshi Pro VB 6 1 March 24th, 2004 06:25 PM





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