PC Review


Reply
Thread Tools Rate Thread

Copying data between workbooks

 
 
Karen53
Guest
Posts: n/a
 
      22nd Feb 2008
Hi,

I thought I'd seen posts on this while looking for other information but now
I need them they are not coming up on any of my searches.

Can I copy cells from a sheet in one workbook into a sheet in another
workbook, but not as a link, the actual value?
--
Thanks for your help.
Karen53
 
Reply With Quote
 
 
 
 
Dave Peterson
Guest
Posts: n/a
 
      22nd Feb 2008
Try recording a macro when you do it manually and you'll have useable code.

Dim RngToCopy as range
dim DestCell as range

set rngtocopy = workbooks("book1.xls").worksheets("sheet999").range("x9:z15")
set destcell = workbooks("book2.xls").worksheets("sheet888").range("a1")

rngtocopy.copy
destcell.pastespecial paste:=xlpastevalues

application.cutcopymode = false

======
or just assign the value:
with rngtocopy
destcell.resize(.rows.count,.columns.count).value = .value
end with

Karen53 wrote:
>
> Hi,
>
> I thought I'd seen posts on this while looking for other information but now
> I need them they are not coming up on any of my searches.
>
> Can I copy cells from a sheet in one workbook into a sheet in another
> workbook, but not as a link, the actual value?
> --
> Thanks for your help.
> Karen53


--

Dave Peterson
 
Reply With Quote
 
Jim Thomlinson
Guest
Posts: n/a
 
      22nd Feb 2008
Yes you can copy cells between workbooks. It will be something like this
(untested but this should be close)...

dim rngCopyFrom as range
Dim wbkCopyTo as workbook
dim rngCopyTo as Range

on error resume next
set wbkCopyto = workbooks("MyFile.xls")
if wbkcopyto is nothing then
set wbkcopyto = workbooks.open("C:\MyFile.xls")
on error goto 0
if wbkcopyto is nothing then
msgbox "Sorry... Can't find the destination file."
else
set rngcopyfrom = thisworkbook.sheets("Sheet1").Range("A1")
set rngcopyto = wbkcopyto.Sheets("Sheet1").Range("A1")

rngcopyto.value = rngcopyfrom.value
wbkcopyto.close
--
HTH...

Jim Thomlinson


"Karen53" wrote:

> Hi,
>
> I thought I'd seen posts on this while looking for other information but now
> I need them they are not coming up on any of my searches.
>
> Can I copy cells from a sheet in one workbook into a sheet in another
> workbook, but not as a link, the actual value?
> --
> Thanks for your help.
> Karen53

 
Reply With Quote
 
Karen53
Guest
Posts: n/a
 
      22nd Feb 2008
My thanks to you both.

I shall boldly(?) go where this person has never gone before.
--
Thanks for your help.
Karen53


"Karen53" wrote:

> Hi,
>
> I thought I'd seen posts on this while looking for other information but now
> I need them they are not coming up on any of my searches.
>
> Can I copy cells from a sheet in one workbook into a sheet in another
> workbook, but not as a link, the actual value?
> --
> Thanks for your help.
> Karen53

 
Reply With Quote
 
Dave Peterson
Guest
Posts: n/a
 
      23rd Feb 2008
Good luck!

Here's hoping you don't end up on Boston Legal with the mad cow!

Karen53 wrote:
>
> My thanks to you both.
>
> I shall boldly(?) go where this person has never gone before.
> --
> Thanks for your help.
> Karen53
>
> "Karen53" wrote:
>
> > Hi,
> >
> > I thought I'd seen posts on this while looking for other information but now
> > I need them they are not coming up on any of my searches.
> >
> > Can I copy cells from a sheet in one workbook into a sheet in another
> > workbook, but not as a link, the actual value?
> > --
> > Thanks for your help.
> > Karen53


--

Dave Peterson
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
copying same data to several Workbooks =?Utf-8?B?TWlyYW5kYQ==?= Microsoft Excel Programming 1 2nd Mar 2007 06:27 PM
Copying data between Workbooks STEVEB Microsoft Excel Programming 0 16th Nov 2005 07:06 PM
Copying data between workbooks? =?Utf-8?B?T25lIERlc3BlcmF0ZSBFbXBsb3llZSE=?= Microsoft Excel Misc 5 24th Sep 2005 09:41 AM
Copying Data between Workbooks Steve Microsoft Excel Misc 1 12th Jun 2004 02:27 PM
Copying Data between Workbooks... zymbo Microsoft Excel Misc 0 16th Jan 2004 04:46 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 11:50 AM.