General discussion


Macro using VBA to Copy..........

By Foxfire2010 ·
I have a workbook where the user needs to import cells from a Worksheet from a Workbook residing on their hard drive, and paste into a Worksheet of an Open Workbook.

The user only knows the file path and file name of the imported worksheet - not at time of programming.
The open Workbook name is also the choice of the user.
Using message box is not practical as most users get frustrated of having to type this in. I have used Workbooks.Openfilename command, but how can I change it to user driven variable. In addition, I was stuck on Workbook.Activate, as again it requires a file name and therefore needs a user driven variable.

Can anyone help me out with the VBA CODE?

This conversation is currently closed to new comments.

Thread display: Collapse - | Expand +

All Comments

Collapse -

by BobHo In reply to Macro using VBA to Copy.. ...

From the programming point of view if you don't know what files are to be opened then the user will either need to type it in or choose it from a list. Try an open dialog and let them search for the file like in most other apps.

Follow this link to view code snippets for acomplishing a variety of tasks:



Related Discussions

Related Forums