excel macro

  • Thread starter Thread starter doug
  • Start date Start date
D

doug

is there a way to have a macro prompt the user to specify
a file to be openedn and then grab data and formulas from
that sheet and bring it into a new project.
thanks
doug
 
Doug, the following is one way to prompt a user for a file:

Dim fNameAndPath As Variant
fNameAndPath = Application.GetOpenFilename _
(FileFilter:="Excel Files (*.XLS), *.XLS", _
Title:="Select File To Be Opened")
If fNameAndPath = False Then _
Exit Sub
MsgBox fNameAndPath

To copy data and formulas over depends a lot on your needs. The simpliest
way to start is to use the macro recorder. Please note the result often
requires a lot of modificaitons.

Bob Flanagan
Macro Systems
http://www.add-ins.com
Productivity add-ins and downloadable books on VB macros for Excel
 
Doug,

Take a look at GetOpenFileName method in help. This will give a browser
dialog. You then have to open the chosen file, and you will be able tyo
access the Activeworkbook Activesheet to get your data.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 

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