ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   excel macro (https://www.excelbanter.com/excel-programming/298657-excel-macro.html)

doug

excel macro
 


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

Bob Flanagan

excel macro
 
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" wrote in message
...


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




Bob Phillips[_6_]

excel macro
 
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)

"doug" wrote in message
...


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





All times are GMT +1. The time now is 03:57 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com