Pasting values from a closed Excel instance

J

Jan Kronsell

I copy a cell containing a date from a sheet of one instance of Excel. Then
closes Excel down. In another instance of Excel I like to PasteSpecial the
value of the cell. The pasting part is what I like to do using VBA. But if I
record a macro it comes up with

ActiveSheet.PasteSpecial Format:="Text"...

So its the text value of the date thats pasted, not the numeric value.

If I try using

Selection.PasteSpecial Paste:=xlPasteValues

I get a runtime error 1004: The method PasteSpecial of class Range failed.

(My own translation from a danish version of Excel, so it may bw incorrect,
but I hope you get the idea.

How should I accomplish what I need?

Jan
 
G

Guest

in the second instance, add a workbook then

dim wb as workbook
set wb = workbooks.add
ws.Activesteet.Paste
ws.Activesteet.Copy

ThisWorkbook.Worksheets("Sheet1").Pastespecial xlAll

wb.close false
 
J

Jan Kronsell

Thanks.

Jan
Patrick Molloy said:
in the second instance, add a workbook then

dim wb as workbook
set wb = workbooks.add
ws.Activesteet.Paste
ws.Activesteet.Copy

ThisWorkbook.Worksheets("Sheet1").Pastespecial xlAll

wb.close false
 
J

Jan Kronsell

Thank you.

Jan
Patrick Molloy said:
in the second instance, add a workbook then

dim wb as workbook
set wb = workbooks.add
ws.Activesteet.Paste
ws.Activesteet.Copy

ThisWorkbook.Worksheets("Sheet1").Pastespecial xlAll

wb.close false
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top