+ Reply to Thread
Results 1 to 15 of 15

Link cell to workbook name

  1. #1
    Forum Expert
    Join Date
    04-23-2009
    Location
    Matrouh, Egypt
    MS-Off Ver
    Excel 2013
    Posts
    6,892

    Link cell to workbook name

    Hello
    I want to put part of the workbook name to cell value

    Say
    Workbook name Test-01
    cell E1 = the last letter of the workbook name so E1=1
    Is it possible ?

  2. #2
    Forum Expert
    Join Date
    04-23-2009
    Location
    Matrouh, Egypt
    MS-Off Ver
    Excel 2013
    Posts
    6,892

    Re: Link cell to workbook name

    I can use this formula
    Please Login or Register  to view this content.
    But I'm searching for UDF that can do that

  3. #3
    Forum Expert
    Join Date
    04-23-2009
    Location
    Matrouh, Egypt
    MS-Off Ver
    Excel 2013
    Posts
    6,892

    Re: Link cell to workbook name

    I devised the following :

    Please Login or Register  to view this content.
    I need your suggestions about that!

  4. #4
    Forum Expert
    Join Date
    04-23-2009
    Location
    Matrouh, Egypt
    MS-Off Ver
    Excel 2013
    Posts
    6,892

    Re: Link cell to workbook name

    I tested my function but when I change the workbook name and open it the value doesn't change at once . I have to press Alt+F9 to get the new results
    I want to do it automatically

  5. #5
    Forum Guru Winon's Avatar
    Join Date
    02-20-2007
    Location
    East Rand, R.S.A.
    MS-Off Ver
    2010
    Posts
    6,113

    Re: Link cell to workbook name

    Hello YasserKhalil,

    why don't you just try it like below.

    Please Login or Register  to view this content.
    Please consider:

    Be polite. Thank those who have helped you. Then Click on the star icon in the lower left part of the contributor's post and add Reputation. Cleaning up when you're done. If you are satisfied with the help you have received, then Please do Mark your thread [SOLVED] .

  6. #6
    Forum Expert
    Join Date
    04-23-2009
    Location
    Matrouh, Egypt
    MS-Off Ver
    Excel 2013
    Posts
    6,892

    Re: Link cell to workbook name

    Quote Originally Posted by Winon View Post
    Hello YasserKhalil,

    why don't you just try it like below.

    Please Login or Register  to view this content.
    Thanks Mr. Winon
    I don't want to put the code in Workbook_open .. as I don't feel satisfied with the codes related to this event..

    And the code may be
    Please Login or Register  to view this content.

  7. #7
    Forum Guru Winon's Avatar
    Join Date
    02-20-2007
    Location
    East Rand, R.S.A.
    MS-Off Ver
    2010
    Posts
    6,113

    Re: Link cell to workbook name

    Hello YasserKhalil,

    Your code may work only if the Workbook Name is exactly seven characters long, otherwise it will fail.

    If you don't want it in the Workbook Open event, you could use in a Macro.

    Please Login or Register  to view this content.

  8. #8
    Forum Expert
    Join Date
    04-23-2009
    Location
    Matrouh, Egypt
    MS-Off Ver
    Excel 2013
    Posts
    6,892

    Re: Link cell to workbook name

    Mr. Winon
    Thank you for your great codes
    Without testing your last code I'm sure it works very well but I will have to run the macro to get my result.I want that automatically as I have 20 workbooks with names like that (name-01) (name-02) and so on
    I want to put the value in E1 so as to use it for many tasks!

    It seems that I will use Workbook_open if I failed my UDF

  9. #9
    Forum Guru Winon's Avatar
    Join Date
    02-20-2007
    Location
    East Rand, R.S.A.
    MS-Off Ver
    2010
    Posts
    6,113

    Re: Link cell to workbook name

    Hi YasserKhalil,

    I want that automatically as I have 20 workbooks ...
    In that case when you get to Workbook (name-10), even my code will fail, so you might want to reconsider returning a value of 1 for Workbook one as "01". That will handle up to 99 Workbooks.

    and the adjusted code for that with Workbook names of any length would be:

    Please Login or Register  to view this content.

  10. #10
    Forum Expert
    Join Date
    04-23-2009
    Location
    Matrouh, Egypt
    MS-Off Ver
    Excel 2013
    Posts
    6,892

    Re: Link cell to workbook name

    what about firing the UDF to get results without pressing Alt + F9
    Is it possible or difficult somewhat.. please explain a little about that

  11. #11
    Forum Expert
    Join Date
    04-23-2009
    Location
    Matrouh, Egypt
    MS-Off Ver
    Excel 2013
    Posts
    6,892

    Re: Link cell to workbook name

    Quote Originally Posted by YasserKhalil View Post
    what about firing the UDF to get results without pressing Alt + F9
    Is it possible or difficult somewhat.. please explain a little about that
    I hope to do that ..using vba

  12. #12
    Forum Expert
    Join Date
    04-23-2009
    Location
    Matrouh, Egypt
    MS-Off Ver
    Excel 2013
    Posts
    6,892

    Re: Link cell to workbook name

    Please help me to do that..

  13. #13
    Forum Guru Winon's Avatar
    Join Date
    02-20-2007
    Location
    East Rand, R.S.A.
    MS-Off Ver
    2010
    Posts
    6,113

    Re: Link cell to workbook name

    Hello YasserKhalil,

    The best way that I can think of to do this, is to use the Workbook Open Event.

    Please Copy and Paste the Code below into your Workbook, and see if it works for you.

    Please Login or Register  to view this content.
    Regards.

  14. #14
    Forum Expert
    Join Date
    04-23-2009
    Location
    Matrouh, Egypt
    MS-Off Ver
    Excel 2013
    Posts
    6,892

    Re: Link cell to workbook name

    Thank you very much Mr. Winon for your great help..

  15. #15
    Forum Guru Winon's Avatar
    Join Date
    02-20-2007
    Location
    East Rand, R.S.A.
    MS-Off Ver
    2010
    Posts
    6,113

    Re: Link cell to workbook name

    Hello YasserKhalil,

    You are welcome, glad I could help, and I trust that you are satisfied with the solution.

    Regards.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 3
    Last Post: 09-25-2014, 12:28 PM
  2. How to Link a cell from one workbook to another
    By cartica in forum Excel General
    Replies: 0
    Last Post: 10-22-2013, 12:58 PM
  3. Cell Link to workbook
    By Ricardo9211 in forum Excel General
    Replies: 3
    Last Post: 12-30-2009, 07:53 AM
  4. [SOLVED] Link to cell in another workbook
    By Shel in forum Excel General
    Replies: 0
    Last Post: 07-23-2006, 10:05 PM
  5. [SOLVED] Link A Cell In O ne Workbook To A Formula In Another Workbook
    By Minitman in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 11-04-2005, 02:15 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1