I need to avaoid an Excel prompt.

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello,

I have the following code in a macro to setup a series of formulas in a
sheet. Trouble is, when run, Excel prompts for me to select the file from a
list. I don't think I should need to select it as I am being specific about
the path and filename in the code.

ActiveCell.Offset(0, 0).Formula = pathname &
Worksheets("variance").Range("I1").Value & ".xls'!" & ActiveCell.Offset(0,
12).Value

(ActiveCell.Offset(0, 12).Value adds a range name to the formula)

Any ideas anyone?

Thanks

Richard
 
hi
trying putting this just before the filepath line...
Application.DisplayAlerts = False
be sure to turn alerts back on BEFORE exiting the sub
Application.DisplayAlerts = True

regards
FSt1
 
Richard,

It seems you're missing an equal sign and a single quote character to
precede the pathname. Try it this way:


ActiveCell.Formula = "='" & pathname &
Worksheets("variance").Range("I1").Value & ".xls'!" & ActiveCell.Offset(0,
12).Value
 
Thanks FSt1,

This certainly helped.

After I ran the macro I needed to update the links and this seems to have
sorted it.....after some further tweaking.

Regards

Richard
 
Thanks for the reply Vergel.

This was not the problem as the =' was included elsewhere, but I certianly
did not help myself by using Pathname as a variable!

Thanks again

Richard
 

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