Copying info from one workbook to another

  • Thread starter Thread starter Slow Thinker
  • Start date Start date
S

Slow Thinker

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!
 
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
 
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---
 

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

Back
Top