+ Reply to Thread
Results 1 to 14 of 14

Need make code faster.

  1. #1
    Forum Contributor
    Join Date
    07-28-2012
    Location
    madrid
    MS-Off Ver
    Excel 2010 at work excel 2016
    Posts
    1,102

    Need make code faster.

    Hi I have below code which have to be used in a very big sheet many rows. around 500000 or more. Its very slowly of course and also i need a code more to be sure its filtered correct, before i run the last code.- But if the codes can be so they run faster would be great. The filtering have to come in this order.

    First i run below code. And that can maybe be done faster. It delete rows in different conditions and in this order,

    Please Login or Register  to view this content.
    Here between i need a new code. It has to delete all the row, if the cell A and b and c are empty. I have found some but they did not work. So between the first and the last i need this new code. All suggestions are welcome also to put the codes together .

    Finally the last code will run. Brilliant code by jindon. It merge the text in column B until next date in column a., It works perfect dont know if this can be made faster.

    Here is the last code.

    Please Login or Register  to view this content.
    Please have a look i cant upload the sheet its very big and thats the problem So hope you can help with out this.

    Thanks in advance.

    Sincerely
    Abjac

  2. #2
    Forum Contributor kalbasiatka's Avatar
    Join Date
    02-27-2016
    Location
    Brest, Belarus
    MS-Off Ver
    2021
    Posts
    224

    Re: Need make code faster.

    What these 8 seconds of pause?
    To do it for me and help me it is 2 different things!
    Sorry for my english, blame Google translator

  3. #3
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,295

    Re: Need make code faster.

    Hi,

    Try changing those .wait lines to
    "DoEvents"
    One test is worth a thousand opinions.
    Click the * Add Reputation below to say thanks.

  4. #4
    Forum Contributor
    Join Date
    07-28-2012
    Location
    madrid
    MS-Off Ver
    Excel 2010 at work excel 2016
    Posts
    1,102

    Re: Need make code faster.

    HI Thanks for the answer. Its not the 8 seconds which make the code slowly. It take nearly one hour to run in a sheet with over 500000 rows. I put the seconds before because it was 4 codes call each other. and i preferred to see when one was finish.- But that is not what make it slowly. Its the big amount of rows. Also as i said i need one more code. Between the 2 codes. If cell a and b and c are blank it has to delete the complete row. According to that the macroes take hours to run i could really need some change if possible.
    Have a look thanks

    Sincerely
    Abjac

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

    Re: Need make code faster.

    Not sure, but try AdvancedFilter instead of AutoFilter. (Normally faster)
    If you need a hand, need to see your sheet layouts with just 10-20 rows of data.

  6. #6
    Forum Contributor kalbasiatka's Avatar
    Join Date
    02-27-2016
    Location
    Brest, Belarus
    MS-Off Ver
    2021
    Posts
    224

    Re: Need make code faster.

    The data on Sheet1
    On Sheet2, select all rows do not fall under the deletion
    Please Login or Register  to view this content.

  7. #7
    Forum Contributor
    Join Date
    07-28-2012
    Location
    madrid
    MS-Off Ver
    Excel 2010 at work excel 2016
    Posts
    1,102

    Re: Need make code faster.

    Hi thanks allot. I am a little handicapped seems my company have closed access to excel forum security risk Hehe. But when home I will try also upload a test sheet. Send from my mobile. Sincerely abjac

  8. #8
    Forum Contributor
    Join Date
    07-28-2012
    Location
    madrid
    MS-Off Ver
    Excel 2010 at work excel 2016
    Posts
    1,102

    Re: Need make code faster.

    HI kalbasiatka I managed to get access to my work at this page . It seems your code are very fast but it just dont give me my wanted result- To make it more clear i have attached a test sheet. All rows in blue have to be deleted. And you can see the conditions out in the right. But i think your code is very fast . So there is hope that it could be good in a big sheet.

    Please have a look and thanks to all-

    Sincerely
    Abjac
    Attached Files Attached Files
    Last edited by abjac; 05-24-2016 at 08:33 AM.

  9. #9
    Forum Contributor kalbasiatka's Avatar
    Join Date
    02-27-2016
    Location
    Brest, Belarus
    MS-Off Ver
    2021
    Posts
    224

    Re: Need make code faster.

    So what's stopping you to try to add a condition for selection?
    Attached Files Attached Files

  10. #10
    Forum Contributor
    Join Date
    07-28-2012
    Location
    madrid
    MS-Off Ver
    Excel 2010 at work excel 2016
    Posts
    1,102

    Re: Need make code faster.

    HI Just tried it at home but its not excel 2013. Tomorrow will try at the big file at my work. I think its brilliant but i will check tomorrow. Thanks for now kalbasiatka. Sincerely Abjac

  11. #11
    Forum Contributor kalbasiatka's Avatar
    Join Date
    02-27-2016
    Location
    Brest, Belarus
    MS-Off Ver
    2021
    Posts
    224

    Re: Need make code faster.

    Quote Originally Posted by abjac View Post
    but its not excel 2013
    Code will work in excel 2003

  12. #12
    Forum Contributor
    Join Date
    07-28-2012
    Location
    madrid
    MS-Off Ver
    Excel 2010 at work excel 2016
    Posts
    1,102

    Re: Need make code faster.

    HI Kalbasiatka.

    I tried the macro on the big file and i cant find out where the error is. It has around 500000 rows so i cant upload it here. It give me a error in this line.

    If a(ii, 3) <> "" Then And it say "type mismatch"

    If any idea what that can be will be great to know.

    Please have a look and sorry i cant upload the real big file. If any email i could do to you private maybe.

    Please have a look

    Sincerely

    abjac

  13. #13
    Forum Contributor
    Join Date
    07-28-2012
    Location
    madrid
    MS-Off Ver
    Excel 2010 at work excel 2016
    Posts
    1,102

    Re: Need make code faster.

    HI I think i found the error. Some cells in row C had a = in front so it was standing like a formula . I run a find and replace to get them of. After it was working.
    The only problem i have now, is that there is still blanks rows. I need a fast macro to remover them. Because if not the last code dont work.

    Please have a look if time to get a very fast code to remove blanks. Its over 500000 rows,

    After remove blanks i need run this code from Jindon. It merge the text in row c in one row until the next date in row B. But this one stop if it come to a blank row,

    Please have a look.

    Sincerely
    Abjac


    the code i have to run in the end. Is the last code called test in top of the thread.

  14. #14
    Forum Contributor
    Join Date
    07-28-2012
    Location
    madrid
    MS-Off Ver
    Excel 2010 at work excel 2016
    Posts
    1,102

    Re: Need make code faster.

    HI I got a solution which was needed. I split the big excel up in 2 sheets, with around 288000 in each and now the last code run through in both of them. I wish the last code could be faster and also not need not to have any blanks. But its working.
    Thanks allot kalbasiatka your code was brilliant and it solved allot for me. The last code is from jindon and its brilliant too but have problem in very big sheets. But great help 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. How to make my code faster?
    By chrisignm in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 01-12-2016, 08:08 PM
  2. [SOLVED] Make code runs faster
    By YasserKhalil in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 09-02-2015, 03:42 PM
  3. [SOLVED] Make code Faster
    By zplugger in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 11-30-2013, 10:08 AM
  4. Make VBA code faster
    By Danielle22 in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 10-28-2013, 09:01 AM
  5. Make the below code work faster!!!
    By devpp in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-04-2013, 06:13 AM
  6. [SOLVED] Make code run faster
    By ozhunter in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-20-2013, 04:26 AM
  7. Helps to make code faster
    By a_driga in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 04-26-2012, 12:25 AM

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