Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming,microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 3
Default Range COPY function - how to copy VALUES and not formulas

I want to use the Copy function to copy the values of a range to a
destination range.

I know that you can do this using copy/paste - as in this example:

Rows("1:1009").Select
Selection.Copy
Sheets("rptTemplate_Report").Select
'Range("A1").Select
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:=
False, Transpose:=False

But I do not want to use this method, since I have 2 range objects - as in
this example:

Set InputRange = Workbook1.Sheets("Sheet1").Range("Range1")
Set TargetRange = Workbook2.Sheets("Sheet1").Range("Range2")
InputRange.Copy TargetRange

This works, but the result fails because this Copy() copies formulas instead
of values.
How do I do that?
thanks


  #2   Report Post  
Posted to microsoft.public.excel.programming,microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 11,123
Default Range COPY function - how to copy VALUES and not formulas

If the ranges have the same size you can use the value property

TargetRange.Value = InputRange.Value


You can use resize to make the TargetRange the same size like this

Set SourceRange = Sheets("Sheet1").Range("A1:c10")
With SourceRange
Set destrange = Sheets("Sheet2").Range("A1"). _
Resize(.Rows.Count, .Columns.Count)
End With
destrange.Value = SourceRange.Value




--
Regards Ron de Bruin
(Win XP Pro SP-1 XL2002 SP-2)
www.rondebruin.nl



"James Cooke" wrote in message ...
I want to use the Copy function to copy the values of a range to a
destination range.

I know that you can do this using copy/paste - as in this example:

Rows("1:1009").Select
Selection.Copy
Sheets("rptTemplate_Report").Select
'Range("A1").Select
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:=
False, Transpose:=False

But I do not want to use this method, since I have 2 range objects - as in
this example:

Set InputRange = Workbook1.Sheets("Sheet1").Range("Range1")
Set TargetRange = Workbook2.Sheets("Sheet1").Range("Range2")
InputRange.Copy TargetRange

This works, but the result fails because this Copy() copies formulas instead
of values.
How do I do that?
thanks




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Copy a file with only values no formulas Lee Coleman New Users to Excel 2 April 6th 07 04:43 PM
How to copy range without changing formulas? [email protected] Excel Discussion (Misc queries) 3 December 31st 06 10:01 PM
How copy a range o cells without adjusting formulas? Oliver Excel Discussion (Misc queries) 4 September 3rd 06 12:44 AM
How do I copy formulas but using the same range each time I copy Laffin Excel Worksheet Functions 2 June 22nd 06 04:17 PM
copy formulas without associated values dranreb Excel Worksheet Functions 0 April 3rd 06 10:22 PM


All times are GMT +1. The time now is 09:56 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"