+ Reply to Thread
Results 1 to 5 of 5

Excel 2007 : File names--entering into a cell

Hybrid View

  1. #1
    Registered User
    Join Date
    02-12-2012
    Location
    Round Rock, TX
    MS-Off Ver
    Excel 2007
    Posts
    5

    File names--entering into a cell

    My goal is to automate the entry of the spreadsheet file name into a cell at the bottom of the spreadsheet. The first step is to find out how to automatically obtain the file name without typing it in. I assume I start by going to the cell into which the name is to be entered. Then what???

    Thanks.

    623bookends

  2. #2
    Forum Expert dilipandey's Avatar
    Join Date
    12-05-2011
    Location
    Dubai, UAE
    MS-Off Ver
    1997 - 2016
    Posts
    8,191

    Re: File names--entering into a cell

    Hi 623bookends,

    Welcome to the forum.

    By saying "automate the entry of the spreadsheet file name into a cell", do you mean to extract the file name of current file which you have opened on your system... ?
    i.e., if I open a workbook "sales.xls" and I want the name "sales" to be automatically extracted in a cell ?
    thanks.

    Regards,
    DILIPandey

    <click on below 'star' if this helps>
    DILIPandey, Excel rMVP
    +919810929744 (India), +971528225509 (Dubai), dilipandey@gmail.com

  3. #3
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    12,927

    Re: File names--entering into a cell

    =CELL("filename")
    Ben Van Johnson

  4. #4
    Registered User
    Join Date
    02-12-2012
    Location
    Round Rock, TX
    MS-Off Ver
    Excel 2007
    Posts
    5

    Re: File names--entering into a cell

    Yes!! It works beautifully. Thanks.

    Now: can you tell me how to get to the bottom left corner of the first page of the spreadsheet so I can put that into a macro? (I could use a footnote but would prefer to have it on the sheet itself so it can be seen when working on the sheet).

    623bookends

  5. #5
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    12,927

    Re: File names--entering into a cell

    There are too many variables: margins, monitor, fonts, window size, print area, etc.
    If you have designed your sheet with specific print area you could use that with something like:
    Option Explicit
    Sub test()
        Dim AreaAddress As String, Bottom As Long
        
        AreaAddress = Worksheets("Sheet1").PageSetup.PrintArea
        Bottom = Range(AreaAddress).Rows.Count - 1
        Cells(Bottom, 1).Value = ThisWorkbook.Name
    End Sub

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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