Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Getting Values From A Different File 1

Status
Not open for further replies.

SandraF

Programmer
Jan 25, 2001
28
US
I was wondering if it is possible to get information from another file.

For example, I am trying to create a macro, and would like to get the values of certain cells from a worksheet called "CONTRACT BRIEF" that is located in another file called MAster5.xls. THe file I am creating the macro in is called Db.Xls.

Any help would be appreciated! THANKS
 
Sandra, you should easily be able to record that macro. But the code would look like this:

Sub Macro1()
Workbooks.Open Filename:="C:\My Documents\master5.xls"
Range("A1:D13").Select
Selection.Copy
Windows("Book2").Activate
Range("D1").Select
ActiveSheet.Paste
Range("A1").Select
End Sub

Of course, there's another alternative:

Copy the stuff once, go to your db.xls file and hit Edit-Paste special-Paste link and save it that way. That way when the data changes in master5.xls, it should automatically change the data in db.xls.
techsupportgirl@home.com
Brainbench MVP for Microsoft Word
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top