PC Review


Reply
Thread Tools Rate Thread

Copying info from one workbook to another

 
 
Slow Thinker
Guest
Posts: n/a
 
      7th Apr 2008
I have to copy info from one workbook to another when the workbook layouts
will remain the same but the workbook names will change from session to
session. How do I indentify the open workbooks in my Macro?

Example "Book1" has a column for last name and age. I want to copy the
contents of the last name column and the value of the age column to two
different columns in another book I have opened up. I just can't seem to get
the syntax right. Any help would be greatly appreciated.

Thank you!
 
Reply With Quote
 
 
 
 
ryguy7272
Guest
Posts: n/a
 
      7th Apr 2008
This should give you what you want, and a whole lot more too:
http://www.rondebruin.nl/tips.htm

See the section titled 'Copy/Paste/Merge examples'


Regards,
Ryan---

--
RyGuy


"Slow Thinker" wrote:

> I have to copy info from one workbook to another when the workbook layouts
> will remain the same but the workbook names will change from session to
> session. How do I indentify the open workbooks in my Macro?
>
> Example "Book1" has a column for last name and age. I want to copy the
> contents of the last name column and the value of the age column to two
> different columns in another book I have opened up. I just can't seem to get
> the syntax right. Any help would be greatly appreciated.
>
> Thank you!

 
Reply With Quote
 
Slow Thinker
Guest
Posts: n/a
 
      7th Apr 2008
Thanks Ryan, the page is loaded with info I know I will be able to use but I
still don't see how to get the macro to grab the names of the two open
workbooks to I can work with them.

Barb

"ryguy7272" wrote:

> This should give you what you want, and a whole lot more too:
> http://www.rondebruin.nl/tips.htm
>
> See the section titled 'Copy/Paste/Merge examples'
>
>
> Regards,
> Ryan---
>
> --
> RyGuy
>
>
> "Slow Thinker" wrote:
>
> > I have to copy info from one workbook to another when the workbook layouts
> > will remain the same but the workbook names will change from session to
> > session. How do I indentify the open workbooks in my Macro?
> >
> > Example "Book1" has a column for last name and age. I want to copy the
> > contents of the last name column and the value of the age column to two
> > different columns in another book I have opened up. I just can't seem to get
> > the syntax right. Any help would be greatly appreciated.
> >
> > Thank you!

 
Reply With Quote
 
ryguy7272
Guest
Posts: n/a
 
      9th Apr 2008
You just select the elements that you want to include in the Pivot Table,
right. Are you talking about importing multiple .xls files? If so,m try
this macro:
Sub Import()
Dim Wb1 As Workbook
Dim Wb2 As Workbook
Dim x As Long
Dim FilesToOpen

FilesToOpen = Application.GetOpenFilename _
(FileFilter:="Text Files (*.xls), *.xls", _
MultiSelect:=True, Title:="Excel Files to Open")

Set Wb1 = ActiveWorkbook
For x = LBound(FilesToOpen) To UBound(FilesToOpen)
Set Wb2 = Workbooks.Open(Filename:=FilesToOpen(x))

Wb2.Worksheets.Copy _
After:=Wb1.Sheets(Wb1.Sheets.Count)

Wb2.Close False
Next x

End Sub

Again, import the data, build a summary sheet with all the data, and then
use this summary sheet as the basis for your Pivot Table. I do this all the
time; works fine for me...

Regards,
Ryan---

--
RyGuy


"Slow Thinker" wrote:

> Thanks Ryan, the page is loaded with info I know I will be able to use but I
> still don't see how to get the macro to grab the names of the two open
> workbooks to I can work with them.
>
> Barb
>
> "ryguy7272" wrote:
>
> > This should give you what you want, and a whole lot more too:
> > http://www.rondebruin.nl/tips.htm
> >
> > See the section titled 'Copy/Paste/Merge examples'
> >
> >
> > Regards,
> > Ryan---
> >
> > --
> > RyGuy
> >
> >
> > "Slow Thinker" wrote:
> >
> > > I have to copy info from one workbook to another when the workbook layouts
> > > will remain the same but the workbook names will change from session to
> > > session. How do I indentify the open workbooks in my Macro?
> > >
> > > Example "Book1" has a column for last name and age. I want to copy the
> > > contents of the last name column and the value of the age column to two
> > > different columns in another book I have opened up. I just can't seem to get
> > > the syntax right. Any help would be greatly appreciated.
> > >
> > > Thank you!

 
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 info from one workbook to another one Mago Microsoft Excel Worksheet Functions 1 7th Apr 2009 11:49 PM
loop through a column on a workbook copying data on each row to another workbook, then copy data back to the original workbook burl_rfc Microsoft Excel Programming 1 1st Apr 2006 08:48 PM
Excel Gurus = want a macro in 1 workbook to get info from another workbook = Read please harry Microsoft Excel Programming 8 20th Dec 2003 03:26 AM
Excel Gurus = want a macro in 1 workbook to get info from another workbook = Read please harry Microsoft Excel Worksheet Functions 1 20th Dec 2003 01:32 AM
Excel Gurus = want a macro in 1 workbook to get info from another workbook = Read please harry Microsoft Excel Misc 1 20th Dec 2003 12:58 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 05:29 AM.