+ Reply to Thread
Results 1 to 6 of 6

select case macro error debug

  1. #1
    Forum Contributor
    Join Date
    02-11-2008
    Location
    India
    MS-Off Ver
    Excel 2013
    Posts
    242

    select case macro error debug

    Hi,
    I have this code which is not running the possible reason which can be is contents of column 'S' has two spaces after which I am not able to remove,pl advice
    Please Login or Register  to view this content.
    Attached Files Attached Files
    Last edited by arnab0711; 01-29-2011 at 02:16 PM.

  2. #2
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: select case macro error debug

    This might help
    Please Login or Register  to view this content.
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  3. #3
    Forum Contributor
    Join Date
    02-11-2008
    Location
    India
    MS-Off Ver
    Excel 2013
    Posts
    242

    Re: select case macro error debug

    Hi,
    I regret to say,the new code is not working,but I have attached the "master" spreadsheet which might help you in decision making.

  4. #4
    Forum Expert Alf's Avatar
    Join Date
    03-13-2004
    Location
    Gothenburg/Mullsjoe, Sweden
    MS-Off Ver
    Excel 2019 and not sure I like it
    Posts
    4,784

    Re: select case macro error debug

    Strange problem.

    If I change your code:

    Please Login or Register  to view this content.
    adding a range select comand:

    Please Login or Register  to view this content.
    you can loop through all the case statment so perhaps your code will work with this modification.

    HTH

    Alf

  5. #5
    Forum Guru (RIP) Marcol's Avatar
    Join Date
    12-23-2009
    Location
    Fife, Scotland
    MS-Off Ver
    Excel '97 & 2003/7
    Posts
    7,216

    Re: select case macro error debug

    @ Alf you get 6 of the strap for suggesting using select ...

    @ arnab0711
    There seems to be two problems that I can see

    1/. You begin the code with a With Statement, then don't refer to it, you have "missed the point" so to speak!

    2/. The Data in Column S is not e.g. IN it is actually IN & Char(160)&Char(160), I suspect this because the data is from the web or similar

    If you check in the intermediate pane
    Please Login or Register  to view this content.
    this will return 4, not 2 as expected.
    Check
    Please Login or Register  to view this content.
    and
    Please Login or Register  to view this content.
    Both return 160

    In this case the Left statement I have used solves the problem, (all cases are 2 characters long)

    Better to clean the original data with a Substitute formula in your workbook

    =SUBSTITUTE(S1,CHAR(160),"")

    or maybe find and replace Char(160) with ""

    Try this
    Please Login or Register  to view this content.

    Hope this helps
    Last edited by Marcol; 01-29-2011 at 05:07 PM.
    If you need any more information, please feel free to ask.

    However,If this takes care of your needs, please select Thread Tools from menu above and set this topic to SOLVED. It helps everybody! ....

    Also
    اس کی مدد کرتا ہے اگر
    شکریہ کہنے کے لئے سٹار کلک کریں
    If you are satisfied by any members response to your problem please consider using the small Star icon bottom left of their post to show your appreciation.

  6. #6
    Forum Expert pike's Avatar
    Join Date
    12-11-2005
    Location
    Alstonville, Australia
    MS-Off Ver
    2016
    Posts
    5,342

    Re: select case macro error debug

    If you are satisfied with the solution(s) provided, please mark your thread as Solved.

    How to mark a thread Solved
    Go to the first post
    Click edit
    Click Go Advanced
    Just below the word Title you will see a dropdown with the word No prefix.
    Change to Solved
    Click Save
    If the solution helped please donate to RSPCA

    Site worth visiting: Rabbitohs

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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