Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 397
Default Insert file name into sheet



Hi There,

I want to have the file name appear in cell a5, on a sheet (say called
"test"). It needs to be able to update when users changes file name..

Any ideas....

Thanks

D

*** Sent via Developersdex http://www.developersdex.com ***
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 718
Default Insert file name into sheet

=CELL("flename")

HTH
--
AP

"Darin Kramer" a écrit dans le message de
...


Hi There,

I want to have the file name appear in cell a5, on a sheet (say called
"test"). It needs to be able to update when users changes file name..

Any ideas....

Thanks

D

*** Sent via Developersdex http://www.developersdex.com ***



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 397
Default Insert file name into sheet

Thanks - but that inserts path as well as filename - is it possible just
to get file name?

Regards

D

*** Sent via Developersdex http://www.developersdex.com ***
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 718
Default Insert file name into sheet

Assuming your =CELL formula is in A1

Enter the following in B1:

=MID(A1,SEARCH("[",A1)+1,SEARCH("]",A1)-SEARCH("[",A1)-1)

HTH
--
AP


"Darin Kramer" a écrit dans le message de
...
Thanks - but that inserts path as well as filename - is it possible just
to get file name?

Regards

D

*** Sent via Developersdex http://www.developersdex.com ***



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default Insert file name into sheet

=CELL("filename")

You need to include a cell reference in the call to CELL. E.g.,

=CELL("filename",A1)

Otherwise, the function will return the name of the workbook that
is active when the formula is calculated, which may not be the
same workbook that contains the formula. The cell reference (it
can be any cell -- it doesn't matter) ensures that the correct
workbook name is returned.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com



"Ardus Petus" wrote in message
...
=CELL("flename")

HTH
--
AP

"Darin Kramer" a écrit dans le
message de
...


Hi There,

I want to have the file name appear in cell a5, on a sheet
(say called
"test"). It needs to be able to update when users changes file
name..

Any ideas....

Thanks

D

*** Sent via Developersdex http://www.developersdex.com ***







  #6   Report Post  
Posted to microsoft.public.excel.programming
GS GS is offline
external usenet poster
 
Posts: 364
Default Insert file name into sheet

In agreement with Chip's recommendation, and to facilitate using only one
cell, you could enter Ardus's formula like this:

=MID(CELL("filename",A1),SEARCH("[",CELL("filename",A1))+1,SEARCH("]",CELL("filename",A1))-SEARCH("[",CELL("filename",A1))-1)

Regards,
GS
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
How do I insert template in new sheet of pre-existing excel file? frustrated Excel Worksheet Functions 5 March 30th 07 08:12 PM
when i insert word art in excel sheet excel file closes automatica marwin Excel Discussion (Misc queries) 1 April 10th 06 03:29 PM
Inserting a row in sheet A should Insert a row in sheet B, removing a row in Sheet A should remove the corresponding row in sheet B Hannes Heckner Excel Programming 1 March 5th 04 09:10 AM
How do I insert/update VBA code into a sheet? (using a CLS file?) Chip Pearson Excel Programming 0 September 14th 03 10:37 PM
Macro to insert values from a file and save another sheet as a .txt file Frank[_16_] Excel Programming 2 August 28th 03 01:07 AM


All times are GMT +1. The time now is 09:55 PM.

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

About Us

"It's about Microsoft Excel"