+ Reply to Thread
Results 1 to 10 of 10

Add the cell value to existing name

  1. #1
    Registered User
    Join Date
    02-22-2013
    Location
    Pakistan
    MS-Off Ver
    2016
    Posts
    95

    Add the cell value to existing name

    I want to add cell value to existing name of excel worksheet
    Like Old Excel file name + Cell value

    I want to do this for all the worksheets in a folder.
    Need updation in Bulk


    Please help

  2. #2
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2404 Win 11 Home 64 Bit
    Posts
    23,860

    Re: Add the cell value to existing name

    A couple of Questions
    1. Is the Cell Value located on the Same Sheet in every file? Provide Sheet Name
    2. Is the Cell Value located in the same Cell in each sheet? Provide Cell Address
    3. Are all files .xlsx files
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  3. #3
    Registered User
    Join Date
    02-22-2013
    Location
    Pakistan
    MS-Off Ver
    2016
    Posts
    95
    Quote Originally Posted by alansidman View Post
    A couple of Questions
    1. Is the Cell Value located on the Same Sheet in every file? Provide Sheet Name
    2. Is the Cell Value located in the same Cell in each sheet? Provide Cell Address
    3. Are all files .xlsx files
    1. Yes. sheet1
    2. Yes. A2
    3. All are xlsx.

  4. #4
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2404 Win 11 Home 64 Bit
    Posts
    23,860

    Re: Add the cell value to existing name

    See if this code works for you:

    Please Login or Register  to view this content.
    Last edited by alansidman; 04-21-2020 at 11:41 AM. Reason: Error noted by OP has been highlighted

  5. #5
    Registered User
    Join Date
    02-22-2013
    Location
    Pakistan
    MS-Off Ver
    2016
    Posts
    95

    Re: Add the cell value to existing name

    It is giving path/File Access error. Runtime error 75. on following line

    ```Name oName As nName```

  6. #6
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2404 Win 11 Home 64 Bit
    Posts
    23,860

    Re: Add the cell value to existing name

    https://www.techwalla.com/articles/h...ntime-error-75

    I don't know how to fix it. I have asked others in this forum to look at it and offer up a fix.
    Last edited by alansidman; 04-21-2020 at 11:39 AM.

  7. #7
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,696

    Re: Add the cell value to existing name

    What is the value of nName at the point where the error occurs? Is it a well-formed path/file name? If so, does a file with this name already exist?
    Jeff
    | | |會 |會 |會 |會 | |:| | |會 |會
    Read the rules
    Use code tags to [code]enclose your code![/code]

  8. #8
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2404 Win 11 Home 64 Bit
    Posts
    23,860

    Re: Add the cell value to existing name

    The way I set it up, and because the OP wanted to append a value to the new name, I needed to drop the .xlsx from the file name to create a new file name with no extension, ie. Myfile2.

    nName is therefore the original path & Myfile2 & the appended value from the worksheet & the extension .xlsx

    This nName did not previously exist.

    I hope this helps you to understand my thinking as I wrote this. Appreciate any thoughts on getting this to work.

  9. #9
    Forum Expert Greg M's Avatar
    Join Date
    08-16-2007
    Location
    Dublin. Ireland
    MS-Off Ver
    Office 2016
    Posts
    4,481

    Re: Add the cell value to existing name

    Hi there,

    See if the following code does what you need:

    Please Login or Register  to view this content.
    The highlighted values may be altered to suit your requirements.


    Hope this helps - please let me know how you get on.

    Regards,

    Greg M


    @alanisdman: I think the main problem was that your code was trying to rename the workbook while it was still open.

  10. #10
    Forum Expert Greg M's Avatar
    Join Date
    08-16-2007
    Location
    Dublin. Ireland
    MS-Off Ver
    Office 2016
    Posts
    4,481

    Re: Add the cell value to existing name

    Many thanks for the Reputation increase - much appreciated!

+ 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. [SOLVED] Adapting Existing Code to Offer Option to Save to Existing Folder
    By AliGW in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 03-28-2019, 07:37 AM
  2. Auto highlight row & column of active cell without deleting existing cell colour
    By claire_wilson in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 10-22-2017, 08:31 PM
  3. Replies: 2
    Last Post: 01-14-2017, 10:57 AM
  4. Add range of data to existing Access table and delete if already existing
    By rousseauassociates in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 04-26-2016, 11:11 AM
  5. Replies: 11
    Last Post: 11-04-2013, 04:32 PM
  6. Replies: 3
    Last Post: 10-14-2013, 03:06 PM
  7. Replies: 1
    Last Post: 08-15-2009, 05:52 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