View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
mendozalaura mendozalaura is offline
external usenet poster
 
Posts: 9
Default Insert columns copied to clipboard results in vaues not foruml

Hi Dave,

Works perfectly up to the last line "rngtocopy.parent.close
savechanges:=false" at which point I get an Error 438 - Object does not
support this property or method.

Can you help?

Thanks

"Dave Peterson" wrote:

You could add: application.cutcopymode = false
before you close the workbook.

But that means you'll have to rearrange your code:

dim RngToCopy as range
dim DestCell as range

set destcell = activesheet.range("L1") 'let excel resize it.

Workbooks.Open Filename:= _
"\\Server\shared\temporary\Laura\Batch summary Sub Assembly.xls"

set rngtocopy = activeworkbook.names("Sub_transfer").referstorange

rngtocopy.copy _
destination:=destcell

application.cutcopymode = false
rngtocopy.parent.close savechanges:=false

End Sub

(untested, watch out for typos)



mendozalaura wrote:

Okay,

This is a little twisted.
Start with an already existing excel file. I need to open another existing
workbook, copy columns L though BR, close the file without saving, then paste
the columns from the clipboard into the original excel file. All of this
works, I can turn off the alerts for "large amount of data pasted to
clipboard etc" however when the columns are pasted from the clipboard into
the original excel file, they are pasted as values and not forumlas. Am I
making any sense, does anyone have ideas.

Code so faris:

Starting with the original excel shet already open...
Then...
Workbooks.Open Filename:= _
"\\Server\shared\temporary\Laura\Batch summary Sub Assembly.xls"
Application.Goto Reference:="Sub_transfer"
Selection.Copy
Application.DisplayAlerts = False
ActiveWindow.Close SaveChanges:=False
Application.CutCopyMode = True
Columns("L:L").Select
ActiveSheet.Paste
Application.DisplayAlerts = True
End Sub

All help would be appreciated.


--

Dave Peterson