+ Reply to Thread
Results 1 to 11 of 11

code ignore different spelling and takes a long time

  1. #1
    Registered User
    Join Date
    08-27-2015
    Location
    Friedberg
    MS-Off Ver
    2010
    Posts
    68

    code ignore different spelling and takes a long time

    Hi all,

    the following code select the column "share sale".
    If anybody write "share sale" in another way (Share Sale, Share sale....) the code ignor the line.
    The other problem is, that the code needs a long time to run. Is there any chance to accelerate the code?

    Please Login or Register  to view this content.
    Kind regards

    Thorsten

  2. #2
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (both in England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2503 (Windows 11 Home 24H2 64-bit)
    Posts
    90,307

    Re: code ignore different spelling and takes a long time

    If anybody write "share sale" in another way (Share Sale, Share sale....) the code ignor the line.
    One way to avoid this is to have a drop-down list for them to choose from with data validation to stop them entering anything not on the list.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help. It's a universal courtesy.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    NB:
    as a Moderator, I never accept friendship requests.
    Forum Rules (updated August 2023): please read them here.

  3. #3
    Registered User
    Join Date
    08-27-2015
    Location
    Friedberg
    MS-Off Ver
    2010
    Posts
    68

    Re: code ignore different spelling and takes a long time

    Thank you. I did this. But not everyone use the drop down list and write in in the cell.

  4. #4
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (both in England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2503 (Windows 11 Home 24H2 64-bit)
    Posts
    90,307

    Re: code ignore different spelling and takes a long time

    A data validation list by default will not allow anything not on the list - check your settings.

  5. #5
    Forum Contributor
    Join Date
    10-25-2011
    Location
    Preston, England
    MS-Off Ver
    Excel 2016
    Posts
    136

    Re: code ignore different spelling and takes a long time

    +1 for data validation settings. Prevention is better than cure.

  6. #6
    Registered User
    Join Date
    08-27-2015
    Location
    Friedberg
    MS-Off Ver
    2010
    Posts
    68

    Re: code ignore different spelling and takes a long time

    Hi I have checked. Settings Data Validation =$AC$4381:$AC$4387 here are the 7 allowed words:
    share sale
    enrolment
    change
    stop
    restart
    cancellation
    leaver

    If you type another word than you get an error message. But if you write uper or lower case it works.

  7. #7
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (both in England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2503 (Windows 11 Home 24H2 64-bit)
    Posts
    90,307

    Re: code ignore different spelling and takes a long time

    That's true ...

  8. #8
    Forum Contributor
    Join Date
    10-25-2011
    Location
    Preston, England
    MS-Off Ver
    Excel 2016
    Posts
    136

    Re: code ignore different spelling and takes a long time

    EDIT: Noticed you only wanted to delete the share sale rows

    Aside from the obvious data validation prevention solution there is also a cure solution

    The reason your macro is slow is the number of copy paste and delete operations - 1 per i. The below code reduces this to 1 total operation.

    Please Login or Register  to view this content.
    Last edited by radddogg; 08-04-2017 at 04:46 AM.

  9. #9
    Registered User
    Join Date
    08-27-2015
    Location
    Friedberg
    MS-Off Ver
    2010
    Posts
    68

    Re: code ignore different spelling and takes a long time

    but this is the Problem. The code should select all lines and ignor if it is upper or lower cases.

  10. #10
    Forum Contributor
    Join Date
    10-25-2011
    Location
    Preston, England
    MS-Off Ver
    Excel 2016
    Posts
    136

    Re: code ignore different spelling and takes a long time

    Quote Originally Posted by torti111 View Post
    but this is the Problem. The code should select all lines and ignor if it is upper or lower cases.
    Please Login or Register  to view this content.

  11. #11
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,050

    Re: code ignore different spelling and takes a long time

    Use
    Please Login or Register  to view this content.
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


+ 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] Translate code takes long time
    By YasserKhalil in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 08-28-2016, 12:58 AM
  2. [SOLVED] msoFileDialogFolderPicker takes very long time to open first time
    By Jacc in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-12-2015, 08:00 AM
  3. Loop that takes a long time
    By batchjb69 in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 06-26-2014, 09:00 AM
  4. Calculation takes long time
    By dorend in forum Excel General
    Replies: 10
    Last Post: 12-13-2011, 06:17 PM
  5. Long code takes an age to run
    By E3iron in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 10-05-2009, 07:38 AM
  6. how do i add time to see how long my macro takes to run
    By ernestgoh in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-16-2006, 06:10 AM
  7. [SOLVED] Save takes long time
    By Jan in forum Excel General
    Replies: 2
    Last Post: 02-15-2006, 02:10 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