Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 31
Default join location string with variable

Hi,

I'm having trouble connecting file location with a file
name. here is what i mean:
In the column A i have file names listed as

aba
abb
abc

these files are located on c:\locations\transfer
i'm trying to get to the Sheet3 and cell E5 on each file.
So at the end i should have
A B
aba value of c:\locations\transfer\[ABA.xls]Sheet3'!e$5
abb value of c:\locations\transfer\[ABB.xls]Sheet3'!e$5
abc value of c:\locations\transfer\[ABC.xls]Sheet3'!e$5

Thank you very much

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default join location string with variable

sFirst = "='C:\locations\transfer\["
sLast = ".xls]Sheet3'!e$5"

set cell = Range("A1")
do while not isempty(cell)
cell.offset(0,1).formula = sFirst & cell.value & sLast
set cell = cell.offset(1,0)
Loop

--
Regards,
Tom Ogilvy

igor wrote in message
...
Hi,

I'm having trouble connecting file location with a file
name. here is what i mean:
In the column A i have file names listed as

aba
abb
abc

these files are located on c:\locations\transfer
i'm trying to get to the Sheet3 and cell E5 on each file.
So at the end i should have
A B
aba value of c:\locations\transfer\[ABA.xls]Sheet3'!e$5
abb value of c:\locations\transfer\[ABB.xls]Sheet3'!e$5
abc value of c:\locations\transfer\[ABC.xls]Sheet3'!e$5

Thank you very much



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 391
Default join location string with variable

First concatenate the text values correctly
A1 value is: abc
B1 value is: c:\locations\transfer\

so C1 =A1 & "[" & B1 & "]sheet3'!E5"

th evalue in C1 should look like the correct formula for
pointing at the cell. I think you;'re still m,issing a
leading single quote.
Now use the INDIRECT function to get th edata out of the
workbopok

D1 = Indirect(C1)


Patrick Molloy
Microsoft Excel MVP

-----Original Message-----
Hi,

I'm having trouble connecting file location with a file
name. here is what i mean:
In the column A i have file names listed as

aba
abb
abc

these files are located on c:\locations\transfer
i'm trying to get to the Sheet3 and cell E5 on each

file.
So at the end i should have
A B
aba value of c:\locations\transfer\[ABA.xls]Sheet3'!e$5
abb value of c:\locations\transfer\[ABB.xls]Sheet3'!e$5
abc value of c:\locations\transfer\[ABC.xls]Sheet3'!e$5

Thank you very much

.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default join location string with variable

You have A1 and B1 reversed between what values are stored and your formula
and you left out the leading single quote in B1 - regardless, Indirect
doesn't work with a closed workbook which is the format of the linking
formula shown.

--
Regards,
Tom Ogilvy

"Patrick Molloy" wrote in message
...
First concatenate the text values correctly
A1 value is: abc
B1 value is: c:\locations\transfer\

so C1 =A1 & "[" & B1 & "]sheet3'!E5"

th evalue in C1 should look like the correct formula for
pointing at the cell. I think you;'re still m,issing a
leading single quote.
Now use the INDIRECT function to get th edata out of the
workbopok

D1 = Indirect(C1)


Patrick Molloy
Microsoft Excel MVP

-----Original Message-----
Hi,

I'm having trouble connecting file location with a file
name. here is what i mean:
In the column A i have file names listed as

aba
abb
abc

these files are located on c:\locations\transfer
i'm trying to get to the Sheet3 and cell E5 on each

file.
So at the end i should have
A B
aba value of c:\locations\transfer\[ABA.xls]Sheet3'!e$5
abb value of c:\locations\transfer\[ABB.xls]Sheet3'!e$5
abc value of c:\locations\transfer\[ABC.xls]Sheet3'!e$5

Thank you very much

.



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default join location string with variable

I posted a VBA solution ~3.75 hrs after you posted the question. You
haven't said why that was rejected.

--
Regards,
Tom Ogilvy

Igor wrote in message
...
Tom,
you are correct, that suggestion helped with thinking but
did not resolve the problem. Any ideas on how to do it??

Thank you to all

-----Original Message-----
You have A1 and B1 reversed between what values are

stored and your formula
and you left out the leading single quote in B1 -

regardless, Indirect
doesn't work with a closed workbook which is the format

of the linking
formula shown.

--
Regards,
Tom Ogilvy

"Patrick Molloy" wrote in

message
...
First concatenate the text values correctly
A1 value is: abc
B1 value is: c:\locations\transfer\

so C1 =A1 & "[" & B1 & "]sheet3'!E5"

th evalue in C1 should look like the correct formula for
pointing at the cell. I think you;'re still m,issing a
leading single quote.
Now use the INDIRECT function to get th edata out of the
workbopok

D1 = Indirect(C1)


Patrick Molloy
Microsoft Excel MVP

-----Original Message-----
Hi,

I'm having trouble connecting file location with a file
name. here is what i mean:
In the column A i have file names listed as

aba
abb
abc

these files are located on c:\locations\transfer
i'm trying to get to the Sheet3 and cell E5 on each
file.
So at the end i should have
A B
aba value of c:\locations\transfer\[ABA.xls]Sheet3'!

e$5
abb value of c:\locations\transfer\[ABB.xls]Sheet3'!

e$5
abc value of c:\locations\transfer\[ABC.xls]Sheet3'!

e$5

Thank you very much

.



.



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Using a variable to point to a location John[_29_] Excel Worksheet Functions 2 August 25th 09 07:27 PM
Use string value for database location - VBA [email protected] Excel Worksheet Functions 1 May 15th 09 01:06 PM
how to set up a simple variable in Excel, but cell location independent Alberta K. New Users to Excel 3 December 19th 07 03:55 PM
find a character location in a string starting from the right funtipoom Excel Worksheet Functions 2 February 15th 07 12:18 AM
Set a range from a variable location Troubled User Excel Discussion (Misc queries) 2 November 27th 05 12:05 AM


All times are GMT +1. The time now is 04:06 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"