LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 747
Default pasting values only

Substitute this in place of the last line:
Range("A2").PasteSpecial xlValues

You might be interested in a technique that doesn't require opening the
source wb. This macro assumes that the destination wb and wks are both
currently active. A dialog is called that lets you identify the source wb.
Data transfer is achieved via linked formulae. The linked formulae are then
converted to values. It's extremely fast.

Sub TransferData()
Dim pos As Integer
Dim p As String
Dim fn As Variant

fn = Application.GetOpenFilename("Excel Files(*.xls), *.xls")
If fn = False Then Exit Sub
pos = InStrRev(fn, "\")
p = Left(fn, pos - 1)
fn = Right$(fn, Len(fn) - pos)
With ActiveSheet.Range("A2:A51")
.Formula = "='" & p & "\[" & fn & "]Sheet1'!A1"
.Value = .Value
End With
End Sub

Regards,
Greg


"ezil" wrote:

While copying and pasting the cell value to another workbook the following
program copies formula instead of values. How to copy value only, without
formula? (range a1:a50 contain formulas)

workbooks.open("abc")
workbooks.open("def")
workbooks("abc").activate
Worksheets(1).Range("a1:a50").Copy
workbooks("def").activate
Worksheets(1).Activate
ActiveSheet.Paste Destination:=Worksheets("SHEET1").Cells(2, 1)

 
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
Bug? Pasting values instead of formulas... Terry A-R Excel Discussion (Misc queries) 10 December 12th 06 06:14 PM
Pasting Values between sheets in VBA Matt Excel Worksheet Functions 1 September 27th 06 05:41 PM
pasting values ceemo Excel Discussion (Misc queries) 0 November 23rd 05 12:39 PM
Pasting Format and values LB79 Excel Discussion (Misc queries) 5 August 25th 05 02:18 PM
pasting values Steiner Excel Discussion (Misc queries) 1 August 11th 05 02:50 PM


All times are GMT +1. The time now is 10:55 AM.

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

About Us

"It's about Microsoft Excel"