excel macro

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
 
B

Bob Flanagan

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
 
B

Bob Phillips

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)
 
Top