+ Reply to Thread
Results 1 to 5 of 5

Renaming and eligible charactrs

  1. #1
    Registered User
    Join Date
    12-11-2019
    Location
    london
    MS-Off Ver
    2007
    Posts
    50

    Renaming and eligible charactrs

    Hi Forum,

    I am importing a lot of sheet via a CommandButton.
    Would like to rename imported sheet with the filename from the imported workbook.

    The naming convention for all workbooks which will be imported is something_anotherthing_2020
    Due to the 31 character sheet limit i would like to only use this part something_anotherthing_2020when trying to rename the sheets. So everything before the first underscore.
    I already have a suffix for each sheet so the filename will be to long if the whole filename is used.


    WSNew1.Name = ActiveListWB.Name & " - report"
    WSNew2.Name = ActiveListWB.Name & " - Pr"

    Moreover is it possible to delete non eligible characters when during this e.g. some&thing = something

    Thanks in advance

  2. #2
    Forum Expert sweep's Avatar
    Join Date
    04-03-2007
    Location
    Great Sankey, Warrington, UK
    MS-Off Ver
    2003 / 2007 / 2010 / 2016 / 365
    Posts
    3,443

    Re: Renaming and eligible charactrs

    Hi,

    You could use Split to remove the part of the name you want to keep..

    Please Login or Register  to view this content.
    There's a function to remove special characters on Stack Overflow that I've used previously..

    https://stackoverflow.com/questions/...book-excel-vba

    Please Login or Register  to view this content.
    Last edited by Pepe Le Mokko; 03-12-2020 at 04:19 AM. Reason: Replace HTML with code tags
    Rule 1: Never merge cells
    Rule 2: See rule 1

    "Tomorrow I'm going to be famous. All I need is a tennis racket and a hat".

  3. #3
    Registered User
    Join Date
    12-11-2019
    Location
    london
    MS-Off Ver
    2007
    Posts
    50

    Re: Renaming and eligible charactrs

    Hi Sweep,

    I have a bit of a difficulty understanding where to attach the newname oldname split?

    Please Login or Register  to view this content.

  4. #4
    Forum Expert sweep's Avatar
    Join Date
    04-03-2007
    Location
    Great Sankey, Warrington, UK
    MS-Off Ver
    2003 / 2007 / 2010 / 2016 / 365
    Posts
    3,443

    Re: Renaming and eligible charactrs

    Hi,

    I assume that ActiveListWB.Name is the string that you're refering to that contains the pattern "something_anotherthing_2020" and you want WSNew1.Name to be set to "something - report"?

    If so,

    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    12-11-2019
    Location
    london
    MS-Off Ver
    2007
    Posts
    50

    Re: Renaming and eligible charactrs

    ohh of course was not following the syntax correctly.
    thanks

+ 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. Color change when driver becomes eligible for another trip
    By bob19taylor in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 09-26-2018, 09:46 AM
  2. Replies: 2
    Last Post: 10-04-2017, 01:14 PM
  3. Replies: 2
    Last Post: 06-27-2016, 11:47 AM
  4. totaling a persons eligible amount
    By TheVolkinator in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 01-21-2016, 06:56 PM
  5. Formula for Vacation Days when eligible
    By tastjuste in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 08-15-2013, 08:11 PM
  6. Search Col.A for words that contain charactrs in Col.B & list all matches adjacently
    By macemegane in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 11-13-2010, 11:17 AM
  7. eligible if
    By gricardo in forum Excel General
    Replies: 6
    Last Post: 02-27-2009, 05:57 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