View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
robzrob robzrob is offline
external usenet poster
 
Posts: 159
Default SET UP FORMULAS AND CODE TO WORK WHEREVER WKB IS USED

Hi

In a cell, I've got this formula

=UPPER(IF(ISNA(MATCH($E$3,'R:\Benefits\...\[BenDatabase.xls]Sheet1'!$A
$1:$A$65536,0)),"",INDEX('R:\Benefits\...\[BenDatabase.xls]Sheet1'!$B
$1:$B$65536,MATCH($E$3,'R:\Benefits\...\[BenDatabase.xls]Sheet1'!$A
$1:$A$65536,1),0)))

and in VBA, I've got this code

Workbooks.Open Filename:= "R:\Benefits\...\BenDatabase.xls"

This is ok when I'm in the office, but when I'm at home, I want this
formula

=UPPER(IF(ISNA(MATCH($E$3,C:\Documents and Settings\...\
[BenDatabase.xls]Sheet1'!$A$1:$A$65536,0)),"",INDEX('C:\Documents and
Settings\...\[BenDatabase.xls]Sheet1'!$B$1:$B$65536,MATCH($E$3,'C:
\Documents and Settings\...\[BenDatabase.xls]Sheet1'!$A$1:$A$65536,1),
0)))

and this code

Workbooks.Open Filename:= "C:\Documents and Settings\...
\BenDatabase.xls"

ie, the workbook BenDatabase.xls is in a different place, depending on
where I'm working. How can I set up the formula and the code to work
wherever I am?

Cheers
Rob