+ Reply to Thread
Results 1 to 7 of 7

Edit cell reference only for save as path, macro lock

  1. #1
    Registered User
    Join Date
    03-08-2012
    Location
    malaysia
    MS-Off Ver
    Excel 2003
    Posts
    8

    Edit cell reference only for save as path, macro lock

    Please help me to solve the issue mentioned herein.

    Im suppose to save a file as "REC AFTER BUSINESS 777.xls" in any location where the original spreadsheet resides.
    Instead I get this "ThisWorkbook.PathREC AFTER BUSINESS 777.xls"

    Criteria: Macro lock, I have no access to it. We are given the option to edit the unprotected cells only.
    Currently, we map our drive differently, some using S: some using P: etc...
    To avoid changing the path frequently, is there a generic way of assigning the path in Range ("D6").


    To edit cell D6, I tried to edit D6 to ThisWorkbook.Path & "\" but failed to run the macro.


    Please Login or Register  to view this content.
    EXCEL SHEET CELLS VALUE AS BELOW

    D3 = 777
    D4 = REC
    D5 = AFTER BUSINESS
    D6 = ThisWorkbook.Path
    Last edited by ntljennifer; 06-28-2014 at 04:37 AM. Reason: inside code to indicate vba area

  2. #2
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 365 on Win11 (desktop), 2019 on Win11 (notebook)
    Posts
    8,198

    Re: Edit cell reference only for save as path, macro lock

    Hi, ntljennifer,

    please have a read at Forum Rule #3 and add code-tags to your procedure.

    If you put ThisWorkbook.Path into a cell it will be treated as a string not as what you want it to be contemplated (the actual path to the workbook).

    Enter the following formula into the cell D6:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    which should show the proper path to the workbook pnce it is saved.

    Ciao,
    Holger
    Use Code-Tags for showing your code: [code] Your Code here [/code]
    Please mark your question Solved if there has been offered a solution that works fine for you

  3. #3
    Registered User
    Join Date
    03-08-2012
    Location
    malaysia
    MS-Off Ver
    Excel 2003
    Posts
    8

    Re: Edit cell reference only for save as path, macro lock

    Hi Guru

    Thanks. It works.

    Could you please explain the formula to me, why $A$1 and the last part with a -2 ?

    Will marked as Solved once I receive the explanation. Cheers!



    Quote Originally Posted by HaHoBe View Post
    Hi, ntljennifer,

    please have a read at Forum Rule #3 and add code-tags to your procedure.

    If you put ThisWorkbook.Path into a cell it will be treated as a string not as what you want it to be contemplated (the actual path to the workbook).

    Enter the following formula into the cell D6:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    which should show the proper path to the workbook pnce it is saved.

    Ciao,
    Holger

  4. #4
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 365 on Win11 (desktop), 2019 on Win11 (notebook)
    Posts
    8,198

    Re: Edit cell reference only for save as path, macro lock

    Hi, ntljennifer,

    according to the Forum Rules which you accepted you should add code-tags to your procedure from the opening post. Until that has been done no further answer to your thread should be given ( Forum Rule #7 ).

    Ciao,
    Holger

  5. #5
    Registered User
    Join Date
    03-08-2012
    Location
    malaysia
    MS-Off Ver
    Excel 2003
    Posts
    8

    Re: Edit cell reference only for save as path, macro lock

    Hello Guru

    Edited as per your request. Sorry for the inconvenience. Still innocent
    about moving around here. Will learn as I progress. Thanks for the guidance.

    Hopefully, you will attend to my query now. Apologies.


    Quote Originally Posted by HaHoBe View Post
    Hi, ntljennifer,

    according to the Forum Rules which you accepted you should add code-tags to your procedure from the opening post. Until that has been done no further answer to your thread should be given ( Forum Rule #7 ).

    Ciao,
    Holger

  6. #6
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 365 on Win11 (desktop), 2019 on Win11 (notebook)
    Posts
    8,198

    Re: Edit cell reference only for save as path, macro lock

    Hi, ntljennifer,

    AFAIK the routine you use in the cell is an old Excel4-function which will retrace the path to the workbook. A1 could be changed to any valid cell reference on the sheet but A1 should be present on any sheet while ZZ1 would not be fitting on an Excel2003-workbook which fesatures only 256 column while ZZ should be 676.

    Find will deliver the position of the of the square bracket indicating the sheetname (have a look at the reference to any closed workbook for understanding). Length minus 2 will deliver the corresponding to ThisWorkbook.Path. If you use minus 1 you will get the trailng backslash from the path as well and would not need to add it.

    HTH,
    Holger

  7. #7
    Registered User
    Join Date
    03-08-2012
    Location
    malaysia
    MS-Off Ver
    Excel 2003
    Posts
    8

    Re: Edit cell reference only for save as path, macro lock

    Thanks for your prompt reply Holger.

    Understand. Have a blessed day ahead.

    Regards
    Jennifer



    Quote Originally Posted by HaHoBe View Post
    Hi, ntljennifer,

    AFAIK the routine you use in the cell is an old Excel4-function which will retrace the path to the workbook. A1 could be changed to any valid cell reference on the sheet but A1 should be present on any sheet while ZZ1 would not be fitting on an Excel2003-workbook which fesatures only 256 column while ZZ should be 676.

    Find will deliver the position of the of the square bracket indicating the sheetname (have a look at the reference to any closed workbook for understanding). Length minus 2 will deliver the corresponding to ThisWorkbook.Path. If you use minus 1 you will get the trailng backslash from the path as well and would not need to add it.

    HTH,
    Holger

+ 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. Save using macro file path
    By RANDY LIPOSKY in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-22-2014, 11:10 AM
  2. how to specify a file save path to a save macro
    By Solidstan in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 10-04-2013, 05:33 PM
  3. Macro with cell reference as a name, but prompt for save location and save as csv
    By tomham in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-15-2012, 06:21 PM
  4. [SOLVED] Macro to save as using path in worksheet
    By Shahid_Excel in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 04-03-2012, 08:16 AM
  5. [SOLVED] Lock a cell from others to edit?
    By tb in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 06-01-2006, 01:10 PM

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