View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Richard M Burton Richard M Burton is offline
external usenet poster
 
Posts: 19
Default I need to avaoid an Excel prompt.

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

"Vergel Adriano" wrote:

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


--
Hope that helps.

Vergel Adriano


"Richard M Burton" wrote:

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