View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Harald Staff Harald Staff is offline
external usenet poster
 
Posts: 1,327
Default EXCEL VBA question

Hi Jill

See if you can use this:

Sub test()
Dim F As Variant
F = Application.GetOpenFilename("Workbooks (*.xls), *.xls", _
, "Select a file to copy into:")
If F = False Then Exit Sub
Workbooks.Open F
End Sub

HTH. Best wishes Harald

"Grace" skrev i melding
...
Hi EXCEL VBA Wizards!

I keep improving a template I use but each time I improve it, I need to
retest it with data from a number of past examples to make sure I haven't
compromised any functionality. In effect, I need to copy and paste

various
blocks of data from the same-named worksheet of an old file to the
same-named worksheet (and locations) of the new template. I think I can

do
this via simple recording of the macro. The only thing I don't know is

the
code to have it, at the outset, ask me what the name of the other EXCEL

file
is and, then, how to tell it to go to that filename, before each copy
command. Can you help me, please, with the specific coding to do this?

I'm thinking something like:

1) have it ask the user via some sort of input message box, for the

filename
I want to use for copying into the current file that will contain the

macro.

2) assign the response and identify it as "X"

3) go to filename X.xls

Thank you,
Jill