ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   create defined name using variable file name in reference (https://www.excelbanter.com/excel-worksheet-functions/250958-create-defined-name-using-variable-file-name-reference.html)

hala

create defined name using variable file name in reference
 
please help in create defined name
EXAMPLe:
create name : ACCPath ---- Referes to (='E:\Data Folder\[externa work
book.xlsx]sheet1'!$K$8:$K$10000)
this works

I NEED to put (external work book.xlsx) in a cell and refere to it as
variable in the referes to (='E:\Data Folder\[&U2&]sheet1'!$K$8:$K$10000)
where U2 having the file name because it is changing meny times

Bob Phillips[_4_]

create defined name using variable file name in reference
 
Activeworkbook.Names.Add Name:="ACCPath", RefersTo:= "=" &
Activesheet.Range("U2").Value2

---
HTH

Bob Phillips

"hala" wrote in message
...
please help in create defined name
EXAMPLe:
create name : ACCPath ---- Referes to (='E:\Data Folder\[externa work
book.xlsx]sheet1'!$K$8:$K$10000)
this works

I NEED to put (external work book.xlsx) in a cell and refere to it as
variable in the referes to (='E:\Data Folder\[&U2&]sheet1'!$K$8:$K$10000)
where U2 having the file name because it is changing meny times




Otávio Alves Ribeiro

create defined name using variable file name in reference
 
Hi there.
You may want to try:

Refers to: =''" & CELL("filename") & "sheet'1!$K$8:$K$10000

This name will be a valid name only after the workbook has been saved.

Regards,
Otávio

"hala" wrote:

please help in create defined name
EXAMPLe:
create name : ACCPath ---- Referes to (='E:\Data Folder\[externa work
book.xlsx]sheet1'!$K$8:$K$10000)
this works

I NEED to put (external work book.xlsx) in a cell and refere to it as
variable in the referes to (='E:\Data Folder\[&U2&]sheet1'!$K$8:$K$10000)
where U2 having the file name because it is changing meny times


Otávio Alves Ribeiro

create defined name using variable file name in reference
 
Just in time (I did not read your post that carefully ...)
You can use the following formula to get the name from another cell:

Refers to: ="'E:\Data Folder\[" & U2 & "]sheet1'!$K$8:$K$10000)

Regards,
Otávio

"Otávio Alves Ribeiro" wrote:

Hi there.
You may want to try:

Refers to: =''" & CELL("filename") & "sheet'1!$K$8:$K$10000

This name will be a valid name only after the workbook has been saved.

Regards,
Otávio

"hala" wrote:

please help in create defined name
EXAMPLe:
create name : ACCPath ---- Referes to (='E:\Data Folder\[externa work
book.xlsx]sheet1'!$K$8:$K$10000)
this works

I NEED to put (external work book.xlsx) in a cell and refere to it as
variable in the referes to (='E:\Data Folder\[&U2&]sheet1'!$K$8:$K$10000)
where U2 having the file name because it is changing meny times



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

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com