+ Reply to Thread
Results 1 to 8 of 8

How to remove "-" from a worksheet?

  1. #1
    Registered User
    Join Date
    09-16-2011
    Location
    Hong Kong
    MS-Off Ver
    Excel 2003
    Posts
    52

    Question How to remove "-" from a worksheet?

    I have the following code that could help to remove "-" in the name of all the worksheets in a workbook, except the worksheet "0-Summary". It works well in one workbook but doesn't in the other. The file extension of one of the workbooks is "xls" while the other (the one that the code doesn't work on) is "xlsm". To make the code work on the xlsm workbook, does the code needs changes? If it does, can anyone help with it? Thanks in advance!

    Please Login or Register  to view this content.
    Last edited by alexxgalaxy; 01-14-2013 at 06:47 AM.

  2. #2
    Forum Contributor
    Join Date
    09-27-2012
    Location
    London, England
    MS-Off Ver
    2003, 2010
    Posts
    344

    Re: How to remove "-" from a worksheet?

    Hi - I tried your code in an .xlsm file and it worked fine for me. What error are you getting while running this in your .xlsm file, can you upload the file to have a look.

    Thanks.
    If solved kindly remember to mark Thread as solved.
    Click the small star icon at the bottom left of my post if this was useful.

  3. #3
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: How to remove "-" from a worksheet?

    If you are running the code from your active workbook, it does not matter what the file extension should be, but if you are accessing through open file path, we need to see what code you have.

  4. #4
    Forum Guru Winon's Avatar
    Join Date
    02-20-2007
    Location
    East Rand, R.S.A.
    MS-Off Ver
    2010
    Posts
    6,113

    Re: How to remove "-" from a worksheet?

    Hello alexxgalaxy,

    I also find it to work as, kbkumar says. Maybe you could check if the correct Macro is being used in the .xlsm WorkBook. The Code I have used is:

    Please Login or Register  to view this content.
    Hope that helps!
    Please consider:

    Be polite. Thank those who have helped you. Then Click on the star icon in the lower left part of the contributor's post and add Reputation. Cleaning up when you're done. If you are satisfied with the help you have received, then Please do Mark your thread [SOLVED] .

  5. #5
    Forum Guru Winon's Avatar
    Join Date
    02-20-2007
    Location
    East Rand, R.S.A.
    MS-Off Ver
    2010
    Posts
    6,113

    Re: How to remove "-" from a worksheet?

    If you have saved the original .xls File on which the code was working as an .xlsm File, and the Macro was assinged to a Button of some sorts, check and re-assign the Macro to run with "ThisWorkBook".

  6. #6
    Registered User
    Join Date
    09-16-2011
    Location
    Hong Kong
    MS-Off Ver
    Excel 2003
    Posts
    52

    Re: How to remove "-" from a worksheet?

    Hi Kbkumar

    I didn't run into error. Just the "-" in the name of xlsm worksheets didn't remove like those in the xls worksheets. Basically, it didn't seem to have any impact. I'll try it again and see if it work when I'm back to office next Monday. My excel at home is 2003. It cannot save as a xlsm file.

    Thanks for the reply!

  7. #7
    Registered User
    Join Date
    09-16-2011
    Location
    Hong Kong
    MS-Off Ver
    Excel 2003
    Posts
    52

    Re: How to remove "-" from a worksheet?

    Quote Originally Posted by Winon View Post
    If you have saved the original .xls File on which the code was working as an .xlsm File, and the Macro was assinged to a Button of some sorts, check and re-assign the Macro to run with "ThisWorkBook".
    Hi Winon

    I didn't assign the Macro to a Button. I'll try again when I'm back to office next Monday. My excel at home is 2003 and I'm not sure if work the same as the excel 2010 in my office. Thanks so much for the revised code!

  8. #8
    Registered User
    Join Date
    09-16-2011
    Location
    Hong Kong
    MS-Off Ver
    Excel 2003
    Posts
    52

    Re: How to remove "-" from a worksheet?

    Hi AB33

    I copied the code from the xls workbook and pasted it to the xlsm workbook. I believe I was running the code from my active workbook.

    Both Kbkumar and Winon tried the code with a xlsm workbook and it worked well. I don't know why it didn't work on mine. I'll try again and when I'm back to work next Friday. I'm using excel 2003 at home and couldn't open a xlsm file.

    Thanks so much for the reply!

+ 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