PC Review


Reply
Thread Tools Rate Thread

How to Change Source Data after copy sheets from another workbook?

 
 
=?Utf-8?B?ZGF2eQ==?=
Guest
Posts: n/a
 
      27th Jan 2007
I have two wookbooks, I call them workbook_A and workbook_B. workBook_B has a
chart in sheet1 and its source data is from sheet2. When I copy the two
sheets from workBook_B into workBook_A:

workBook_B.Worksheets.Copy(MissingValue, workBook_A.Sheets.get_Item(2));

After Copy, the Source data of chart in workBook_A still link to the
outside original workbook: workBook_B. Any friend can tell me how I can keep
the source data inside a workbook after copying? cheers.


 
Reply With Quote
 
 
 
 
Dave Peterson
Guest
Posts: n/a
 
      27th Jan 2007
I think you have a couple of choices.

You can let the formulas point back at the original workbook and then do
Edit|Links|change source (record a macro if you need code).

Or you could convert the formulas to strings, copy the worksheet, and convert
those strings back to formulas.

I like to do this (for each sheet):

Select all the cells
edit|Replace
what: = (equal sign)
with: $$$$$=
replace all

Then the copy.

And reverse the process (for each sheet in both the sending and receiving
workbooks)

Select all the cells
edit|Replace
what: $$$$$=
with: =
replace all

Recording a macro when you do it manually will give you a good start on the
code.



davy wrote:
>
> I have two wookbooks, I call them workbook_A and workbook_B. workBook_B has a
> chart in sheet1 and its source data is from sheet2. When I copy the two
> sheets from workBook_B into workBook_A:
>
> workBook_B.Worksheets.Copy(MissingValue, workBook_A.Sheets.get_Item(2));
>
> After Copy, the Source data of chart in workBook_A still link to the
> outside original workbook: workBook_B. Any friend can tell me how I can keep
> the source data inside a workbook after copying? cheers.


--

Dave Peterson
 
Reply With Quote
 
=?Utf-8?B?ZGF2eQ==?=
Guest
Posts: n/a
 
      27th Jan 2007
Thanks Dave Peterson, I'm new to VSTO, it will take some time to examine our
solutons, if you can give a simple example in c#, that would be perfect!
cheers.

"Dave Peterson" wrote:

> I think you have a couple of choices.
>
> You can let the formulas point back at the original workbook and then do
> Edit|Links|change source (record a macro if you need code).
>
> Or you could convert the formulas to strings, copy the worksheet, and convert
> those strings back to formulas.
>
> I like to do this (for each sheet):
>
> Select all the cells
> edit|Replace
> what: = (equal sign)
> with: $$$$$=
> replace all
>
> Then the copy.
>
> And reverse the process (for each sheet in both the sending and receiving
> workbooks)
>
> Select all the cells
> edit|Replace
> what: $$$$$=
> with: =
> replace all
>
> Recording a macro when you do it manually will give you a good start on the
> code.
>
>
>
> davy wrote:
> >
> > I have two wookbooks, I call them workbook_A and workbook_B. workBook_B has a
> > chart in sheet1 and its source data is from sheet2. When I copy the two
> > sheets from workBook_B into workBook_A:
> >
> > workBook_B.Worksheets.Copy(MissingValue, workBook_A.Sheets.get_Item(2));
> >
> > After Copy, the Source data of chart in workBook_A still link to the
> > outside original workbook: workBook_B. Any friend can tell me how I can keep
> > the source data inside a workbook after copying? cheers.

>
> --
>
> Dave Peterson
>

 
Reply With Quote
 
Dave Peterson
Guest
Posts: n/a
 
      27th Jan 2007
Not from me!

I don't speak any flavors of C.

Sorry.

davy wrote:
>
> Thanks Dave Peterson, I'm new to VSTO, it will take some time to examine our
> solutons, if you can give a simple example in c#, that would be perfect!
> cheers.
>
> "Dave Peterson" wrote:
>
> > I think you have a couple of choices.
> >
> > You can let the formulas point back at the original workbook and then do
> > Edit|Links|change source (record a macro if you need code).
> >
> > Or you could convert the formulas to strings, copy the worksheet, and convert
> > those strings back to formulas.
> >
> > I like to do this (for each sheet):
> >
> > Select all the cells
> > edit|Replace
> > what: = (equal sign)
> > with: $$$$$=
> > replace all
> >
> > Then the copy.
> >
> > And reverse the process (for each sheet in both the sending and receiving
> > workbooks)
> >
> > Select all the cells
> > edit|Replace
> > what: $$$$$=
> > with: =
> > replace all
> >
> > Recording a macro when you do it manually will give you a good start on the
> > code.
> >
> >
> >
> > davy wrote:
> > >
> > > I have two wookbooks, I call them workbook_A and workbook_B. workBook_B has a
> > > chart in sheet1 and its source data is from sheet2. When I copy the two
> > > sheets from workBook_B into workBook_A:
> > >
> > > workBook_B.Worksheets.Copy(MissingValue, workBook_A.Sheets.get_Item(2));
> > >
> > > After Copy, the Source data of chart in workBook_A still link to the
> > > outside original workbook: workBook_B. Any friend can tell me how I can keep
> > > the source data inside a workbook after copying? cheers.

> >
> > --
> >
> > Dave Peterson
> >


--

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
Copy Selected Sheets' Data On New Workbook! Faraz A. Qureshi Microsoft Excel Programming 0 15th Dec 2009 12:27 PM
Copy data from specific sheets from one workbook to another mtuohey Microsoft Excel Programming 0 28th Aug 2008 11:34 PM
Change source data to all sheets Vlad999 Microsoft Excel Programming 1 30th May 2006 12:44 AM
Copy tabs(sheets) from workbook without link to original source Rich Ulichny Microsoft Excel Misc 3 25th Aug 2005 02:11 AM
copy data in one sheet to multiple sheets in same workbook =?Utf-8?B?QnJpYW5NdWx0aUxhbmd1YWdl?= Microsoft Excel Worksheet Functions 4 27th Jul 2005 07:26 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 07:01 AM.