+ Reply to Thread
Results 1 to 7 of 7

Change the name of a sheet in a closed workbook

  1. #1
    Registered User
    Join Date
    03-14-2018
    Location
    Sweden
    MS-Off Ver
    2013
    Posts
    5

    Change the name of a sheet in a closed workbook

    Hello,

    Can I in some way change the name of three sheets in a closed workbook? I then want to import data from that workbook but that does not work as I have to first rename some of the sheets.

    How do I solve this problem?

  2. #2
    Forum Expert Olly's Avatar
    Join Date
    09-10-2013
    Location
    Darlington, UK
    MS-Off Ver
    Excel 2016, 2019, 365
    Posts
    6,284

    Re: Change the name of a sheet in a closed workbook

    Why do you need to change the worksheet name?

    How are you currently importing the data?
    let Source = #table({"Question","Thread", "User"},{{"Answered","Mark Solved", "Add Reputation"}}) in Source

    If I give you Power Query (Get & Transform Data) code, and you don't know what to do with it, then CLICK HERE

    Walking the tightrope between genius and eejit...

  3. #3
    Registered User
    Join Date
    03-14-2018
    Location
    Sweden
    MS-Off Ver
    2013
    Posts
    5

    Re: Change the name of a sheet in a closed workbook

    The file is coming from a system that names 3 out of 7 namnes with a . in the name example "RET. MAT. AQ" and those names I have changed them manually. the names that are ex "RETURN MATERIAL AQ" works without me renaming the name of the sheet.

    Therefore I want to rename some of the sheets without . so that I can import all the data in the same way.

  4. #4
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 2013
    Posts
    7,810

    Re: Change the name of a sheet in a closed workbook

    If you open the workbook and run this macro, it will remove all the periods in the sheet names. If you want the macro to open the workbook for you, I would need the workbook name including the extension and the full path to the folder containing it.
    Please Login or Register  to view this content.
    You can say "THANK YOU" for help received by clicking the Star symbol at the bottom left of the helper's post.
    Practice makes perfect. I'm very far from perfect so I'm still practising.

  5. #5
    Registered User
    Join Date
    03-14-2018
    Location
    Sweden
    MS-Off Ver
    2013
    Posts
    5

    Re: Change the name of a sheet in a closed workbook

    I want to run the macro from antother workbook. The name of the workbook that I want to change the names of the sheets is NCRexport and the full path to the folder is C:\Users\sejubru\Desktop\NCR

    I also want the macro to close the workbook when it has changed the names of the sheets, could you also add that for me?

    Thank you!

  6. #6
    Forum Expert Olly's Avatar
    Join Date
    09-10-2013
    Location
    Darlington, UK
    MS-Off Ver
    Excel 2016, 2019, 365
    Posts
    6,284

    Re: Change the name of a sheet in a closed workbook

    I don't understand why you need to change the worksheet names - unless your import code refers to sheet names, in which case why not simply change this, to loop through all the worksheets in the source file, for example? Then the sheet names would be irrelevant.

    I bet it would be more efficient using Power Query, too...

  7. #7
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 2013
    Posts
    7,810

    Re: Change the name of a sheet in a closed workbook

    Try:
    Please Login or Register  to view this content.
    I am assuming that the NCRexport workbook has an "xlsx" extension. Change the extension in the code to suit your needs.

+ 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] vba code to copy a specific sheet from a closed workbook to the active workbook
    By JEAN1972 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 11-01-2017, 03:09 AM
  2. [SOLVED] vba copy specific sheet from closed workbook to active workbook
    By JEAN1972 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-12-2017, 01:33 PM
  3. [SOLVED] copy specific sheet from closed workbook to active workbook
    By JEAN1972 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-10-2017, 10:26 PM
  4. vba copy specific sheet from closed workbook to active workbook
    By JEAN1972 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-09-2017, 02:34 PM
  5. Change certain values within closed workbook
    By jeffreybrown in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-20-2012, 01:51 PM
  6. Copy One Sheet From One Closed Workbook To Another Closed WB
    By teshiburu1988 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-04-2009, 11:49 AM
  7. Can I change this to work for a closed workbook
    By Shawn in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-22-2005, 12:05 PM

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