+ Reply to Thread
Results 1 to 27 of 27

VBA Change Loop count from 1000 to 1

  1. #1
    Registered User
    Join Date
    05-07-2021
    Location
    germany
    MS-Off Ver
    2019
    Posts
    13

    VBA Change Loop count from 1000 to 1

    Hello i found this script, problem it is very slow and i am not able to change it that it is working faster.

    I would like to count the cells from A 1000 to A1 (in active table) and do something.

    The code below do the work but super slow, and sometimes it will not stop woking.

    Could you help me please ?
    I tried to set i = 1000 that doesnt help and bring me in an endless loop (i think)


    Please Login or Register  to view this content.

  2. #2
    Forum Guru Sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2019 | 2021
    Posts
    14,957

    Re: VBA Change Loop count from 1000 to 1

    I would like to count the cells from A 1000 to A1 (in active table) and do something.
    Your provided code is checking length of cell?
    Use a helper column with formula...Filter on result and delete rows at once...Upload sample file if you need clarity...
    Good Luck...
    I don't presume to know what I am doing, however, just like you, I too started somewhere...
    One-day, One-problem at a time!!!
    If you feel I have helped, please click on the [★ Add Reputation] to left of post window...
    Also....Add a comment if you like!!!!
    And remember...Mark Thread as Solved...
    Excel Forum Rocks!!!

  3. #3
    Registered User
    Join Date
    05-07-2021
    Location
    germany
    MS-Off Ver
    2019
    Posts
    13

    Re: VBA Change Loop count from 1000 to 1

    Dear sintek, sorry i am a totaly new in Excel and i have no idea what you mean.

    I know a little bit javascript programming but nothing with table manipulation.

    Do you have an code example for me ?

    Thank you :-)

  4. #4
    Forum Guru Sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2019 | 2021
    Posts
    14,957

    Re: VBA Change Loop count from 1000 to 1

    Depends what you actually want to do...
    Are you wanting to delete all rows where length of Col A cells is less than 4?

  5. #5
    Registered User
    Join Date
    05-07-2021
    Location
    germany
    MS-Off Ver
    2019
    Posts
    13

    Re: VBA Change Loop count from 1000 to 1

    Yes , the do something i think work good and do what i want . I think the for loop goes from the last row of the table to 1 . I just have 400 rows with data so 1000 would be more than enough.

    Could that be a quick solution ?
    Last edited by blablagei; 05-07-2021 at 04:12 AM.

  6. #6
    Forum Guru Sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2019 | 2021
    Posts
    14,957

    Re: VBA Change Loop count from 1000 to 1

    Upload sample file (exact setup as actual file) so that a few solutions can be offered...

  7. #7
    Registered User
    Join Date
    05-07-2021
    Location
    germany
    MS-Off Ver
    2019
    Posts
    13

    Re: VBA Change Loop count from 1000 to 1

    I do not know how to upload. On image insert button ? I cant do attachments , blank white line.
    Last edited by blablagei; 05-07-2021 at 04:26 AM.

  8. #8
    Forum Guru Sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2019 | 2021
    Posts
    14,957

    Re: VBA Change Loop count from 1000 to 1

    See Top Yellow Banner

  9. #9
    Forum Expert
    Join Date
    07-23-2018
    Location
    UK
    MS-Off Ver
    O365 32bit (Windows)
    Posts
    2,975

    Re: VBA Change Loop count from 1000 to 1

    Quote Originally Posted by sintek View Post
    Your provided code is checking length of cell?
    Use a helper column with formula...Filter on result and delete rows at once
    For length < 4, could also filter with a criteria equal to ???

  10. #10
    Forum Guru Sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2019 | 2021
    Posts
    14,957

    Re: VBA Change Loop count from 1000 to 1

    criteria equal to ???
    what about 1,2 ? and will only work with alpha or alpha numeric...

  11. #11
    Registered User
    Join Date
    05-07-2021
    Location
    germany
    MS-Off Ver
    2019
    Posts
    13

    Re: VBA Change Loop count from 1000 to 1

    I couldnt load it up couse i do not know how to bring that file under 1000 kb
    7 zip doesnt work to tell me invalid file .
    Links to my cloud are also not allowed.

  12. #12
    Forum Guru Sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2019 | 2021
    Posts
    14,957

    Re: VBA Change Loop count from 1000 to 1

    Upload a small sample file...Couple of lines...but same format as actual file...

  13. #13
    Forum Expert
    Join Date
    07-23-2018
    Location
    UK
    MS-Off Ver
    O365 32bit (Windows)
    Posts
    2,975

    Re: VBA Change Loop count from 1000 to 1

    Sorry I meant in a vba loop. Would be 3 iterations rather than 1000 if a helper col wasn't an option.

  14. #14
    Registered User
    Join Date
    05-07-2021
    Location
    germany
    MS-Off Ver
    2019
    Posts
    13

    Re: VBA Change Loop count from 1000 to 1

    I just have 11 rows and the vba script inside 9000 kb

  15. #15
    Registered User
    Join Date
    05-07-2021
    Location
    germany
    MS-Off Ver
    2019
    Posts
    13

    Re: VBA Change Loop count from 1000 to 1

    m 39
    kühroint 11
    wandern 15
    pin 5
    www 12
    c 3

  16. #16
    Registered User
    Join Date
    05-07-2021
    Location
    germany
    MS-Off Ver
    2019
    Posts
    13

    Re: VBA Change Loop count from 1000 to 1

    The for loop goes collums down and delete every row wich has no more than 3 letters. How can i set the loop to start at 1000 and go to 1 ?

    I think the script on top start at the end of the table and thats why its working so long couse its deleting empty ceels.
    Last edited by blablagei; 05-07-2021 at 05:10 AM.

  17. #17
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,834

    Re: VBA Change Loop count from 1000 to 1

    Easy...
    Please Login or Register  to view this content.

  18. #18
    Registered User
    Join Date
    05-07-2021
    Location
    germany
    MS-Off Ver
    2019
    Posts
    13

    Re: VBA Change Loop count from 1000 to 1

    Thank you Guru i will try that.

  19. #19
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,834

    Re: VBA Change Loop count from 1000 to 1

    Try this one too.
    Please Login or Register  to view this content.

  20. #20
    Registered User
    Join Date
    05-07-2021
    Location
    germany
    MS-Off Ver
    2019
    Posts
    13

    Re: VBA Change Loop count from 1000 to 1

    Thank you Jindon ! and all others who try to help me it works (like a skyrocket :-))

    Thank you so much !

    Here is the working Example for all how need that in future:


    Please Login or Register  to view this content.

  21. #21
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,834

    Re: VBA Change Loop count from 1000 to 1

    ..............................

  22. #22
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,834

    Re: VBA Change Loop count from 1000 to 1

    You are welcome.

    I suggest you to add a variable.

    e.g
    Please Login or Register  to view this content.
    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED.

    Also, you may not be aware that you can thank those who have helped you by clicking the small star icon located in the lower left corner of the post in which the help was given. By doing so you can add to the reputation(s) of those who helped.

  23. #23
    Registered User
    Join Date
    05-07-2021
    Location
    germany
    MS-Off Ver
    2019
    Posts
    13

    Re: VBA Change Loop count from 1000 to 1

    Wow super thank you Jindon , i will try to mark your post as solution.

  24. #24
    Forum Guru Sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2019 | 2021
    Posts
    14,957

    Re: VBA Change Loop count from 1000 to 1

    delete every row which has no more than 3 letters
    For future reference...no loop option...
    Please Login or Register  to view this content.
    Last edited by Sintek; 05-07-2021 at 05:53 AM.

  25. #25
    Registered User
    Join Date
    05-07-2021
    Location
    germany
    MS-Off Ver
    2019
    Posts
    13

    Re: VBA Change Loop count from 1000 to 1

    Super cool Sintek thank you , i played with your script.

    It is faster than the Loop. The Example on Top delete every word wich have more than 3 Letters.
    To Change that Line 3 after Adress >3

    The Data in A .

    Super Scripts to learn :-)
    Last edited by blablagei; 05-07-2021 at 09:38 AM.

  26. #26
    Forum Guru Sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2019 | 2021
    Posts
    14,957

    Re: VBA Change Loop count from 1000 to 1

    Not quite understanding your requirement...
    Easier with sample files and expected output showing...

  27. #27
    Registered User
    Join Date
    05-07-2021
    Location
    germany
    MS-Off Ver
    2019
    Posts
    13

    Re: VBA Change Loop count from 1000 to 1

    Ok thank you i will open a new post later , and learn how to upload files. I think the administration would like to do so. :-)

+ 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. Loop for iterating 1000 times
    By spamspam07 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-12-2020, 01:12 AM
  2. WorkbookConnection.Refreshing not triggering in a while sleep(1000) loop
    By HansSchulze in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-16-2020, 11:22 PM
  3. custom format to change to a multiple of 1000
    By ammartino44 in forum Excel General
    Replies: 3
    Last Post: 06-10-2015, 06:40 PM
  4. Replies: 3
    Last Post: 04-01-2012, 07:54 AM
  5. 1st Timer: Transpose separated data sets into adjacent row, put on loop x 1000
    By yeamonn in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-02-2012, 12:10 AM
  6. How change maximal value in excel for filter (1000) ?
    By Poul in forum Excel - New Users/Basics
    Replies: 1
    Last Post: 07-27-2006, 11:10 AM
  7. [SOLVED] in excel, want data to change auto from 1000 to one thousand
    By pleasehelpthanks in forum Excel General
    Replies: 1
    Last Post: 06-20-2006, 02:35 AM

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