Would like to have a cell value the the name of the excell file I am creating.
Similar to inserting the file name into the header or footer.
You can use the function CELL, with the quot;filenamequot; argument:
=CELL(quot;filenamequot;)
This returns the full path. In case you just want the name you may need to
use some text functions. In the case I tried, with Excel 2003, the file name
was enclosed in braquets, so this formula gave just the bare name:
=MID(CELL(quot;filenamequot;),FIND(quot;[quot;,CELL(quot;filenamequot;),1) 1,FIND(quot;]quot;,CELL(quot;filenamequot;),1)-FIND(quot;[quot;,CELL(quot;filenamequot;),1)-1)
Hope this helps,
Miguel.
quot;Dougquot; wrote:
gt; Would like to have a cell value the the name of the excell file I am creating.
gt; Similar to inserting the file name into the header or footer.
Doug Wrote:
gt; Would like to have a cell value the the name of the excell file I am
gt; creating.
gt; Similar to inserting the file name into the header or footer.
The following formula will return the full path, filename and current
sheet name:
=CELL(quot;filenamequot;,A1)
Where it gets interesting is if you want to isolate the file name only.
For example, =CELL(quot;filenamequot;,A1) may return
D:\Jupiter\MyDocuments\[doobie.xls]Sheet1
If all you want is
doobie.xls
you need:
=MID(CELL(quot;filenamequot;,A1),FIND(quot;[quot;,CELL(quot;filenamequot;,A1)) 1,FIND(quot;]quot;,CELL(quot;filenamequot;,A1))-FIND(quot;[quot;,CELL(quot;filenamequot;,A1))-1)
The portion of the formula in red returns the position of the first
character of the actual filename.
The portion of the formula in blue returns the length of the actual
filename.
If all you want is -doobie.xls- you need the following:--
CaptainQuattro
------------------------------------------------------------------------
CaptainQuattro's Profile: www.excelforum.com/member.php...oamp;userid=32763
View this thread: www.excelforum.com/showthread...hreadid=542743Just for fun
=REPLACE(SUBSTITUTE(CELL(quot;filenamequot;),INFO(quot;directo ryquot;)amp;quot;[quot;,quot;quot;),FIND(quot;]quot;,SUBSTITUTE(CELL(quot;filenamequot;),INFO(quot;directoryquot; )amp;quot;[quot;,quot;quot;)),255,quot;quot;)
--
Regards,
Peo Sjoblom
Excel 95 - Excel 2007
Northwest Excel Solutions
www.nwexcelsolutions.com
quot;It is a good thing to follow the first law of holes;
if you are in one stop digging.quot; Lord Healeyquot;Miguel Zapicoquot; gt; wrote in message
...
gt; You can use the function CELL, with the quot;filenamequot; argument:
gt; =CELL(quot;filenamequot;)
gt; This returns the full path. In case you just want the name you may need
gt; to
gt; use some text functions. In the case I tried, with Excel 2003, the file
gt; name
gt; was enclosed in braquets, so this formula gave just the bare name:
gt; =MID(CELL(quot;filenamequot;),FIND(quot;[quot;,CELL(quot;filenamequot;),1) 1,FIND(quot;]quot;,CELL(quot;filenamequot;),1)-FIND(quot;[quot;,CELL(quot;filenamequot;),1)-1)
gt;
gt; Hope this helps,
gt; Miguel.
gt;
gt; quot;Dougquot; wrote:
gt;
gt;gt; Would like to have a cell value the the name of the excell file I am
gt;gt; creating.
gt;gt; Similar to inserting the file name into the header or footer.
- Mar 13 Thu 2008 20:43
Entering a filename as a variable into cell similar as for footer
close
全站熱搜
留言列表
發表留言