+ Reply to Thread
Results 1 to 13 of 13

Make VBA Faster

  1. #1
    Registered User
    Join Date
    07-26-2013
    Location
    Graubünden, Switzerland
    MS-Off Ver
    Excel 2010
    Posts
    7

    Question Make VBA Faster

    Hey all together

    Can someone help me making my VBA Code / Makro faster? Or isnt it possible at all?

    It needs to work over more then 900'000 Cells. I'll just Post the Code, so someone who has time can take a look at it and maybe tell me how to improve it?

    Also a problem i have is that i think it isnt finishing ever. It feels like its not stoping the loop at all. Then when i stop the macro manualy, it has finished the hole macro as expected (after about half an hour)

    Thanks in advance :D

    Please Login or Register  to view this content.

  2. #2
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643
    If you want to speed up the code the first thing you should do is get rid of all the Select stuff.
    If posting code please use code tags, see here.

  3. #3
    Registered User
    Join Date
    07-26-2013
    Location
    Graubünden, Switzerland
    MS-Off Ver
    Excel 2010
    Posts
    7

    Re: Make VBA Faster

    Thank you for the fast response and for the tip.
    I'm pretty a noob in VBA, as seen in the code above :P when i'm replacing the .select stuff, what do i need to use instead? it seemed to me as an easy code for what i wanted to do..

  4. #4
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643
    I'm not sure, mainly because I don't know what you are trying to do.

  5. #5
    Registered User
    Join Date
    07-26-2013
    Location
    Graubünden, Switzerland
    MS-Off Ver
    Excel 2010
    Posts
    7

    Re: Make VBA Faster

    I'm exporting an excel file from another Program called IS-E, and to evaluate this sheet, i made an huge formula before.

    Now i'm copying the old format (Because the new release of the program is exporting the excel file in another way), putting the exported data in the new Sheet, here called "Auswertung", putting the formula ind W3:S92000, and then i need to delete al "empty-appearing" cells, because they arent really empty at all. and when they arent empty, i'm getting an #Value error. So there i think is it where it stays all the time. is this enough to give you a picture of what i am trying to reach?

  6. #6
    Forum Expert
    Join Date
    04-22-2013
    Location
    .
    MS-Off Ver
    .
    Posts
    4,418

    Re: Make VBA Faster

    Something like:
    Please Login or Register  to view this content.

  7. #7
    Registered User
    Join Date
    07-26-2013
    Location
    Graubünden, Switzerland
    MS-Off Ver
    Excel 2010
    Posts
    7

    Re: Make VBA Faster

    Thank you very much. That really was an improvement as far as i can say

    Now a question. Is it possible to tell the macro it should look in the Sheet that it is importing of the other file, how many Cells are written, and than only apply the format pasting and the value pasting and, as the most important and time eating thing, deleting "empty-appearing" cells to that amount / range of cells? so not always all 92'000 if there are only, per example, 30'000 written in the Sheet that i want to evaluate? is that somehow possible?

  8. #8
    Forum Expert
    Join Date
    04-22-2013
    Location
    .
    MS-Off Ver
    .
    Posts
    4,418

    Re: Make VBA Faster

    Please Login or Register  to view this content.
    ?

  9. #9
    Registered User
    Join Date
    07-26-2013
    Location
    Graubünden, Switzerland
    MS-Off Ver
    Excel 2010
    Posts
    7

    Re: Make VBA Faster

    Exactly what i wanted thank you so much, only tested it with a part of the code, but will insert it into the whole thing later

  10. #10
    Forum Expert
    Join Date
    04-22-2013
    Location
    .
    MS-Off Ver
    .
    Posts
    4,418

    Re: Make VBA Faster

    You may also find using something like:
    Please Login or Register  to view this content.
    to be quicker than:
    Please Login or Register  to view this content.
    You can do a similar thing with formats but it depends how much formatting there is as I think you need to change each property (color, border, border thickness, font, font size, font color etc) separately.

  11. #11
    Registered User
    Join Date
    07-26-2013
    Location
    Graubünden, Switzerland
    MS-Off Ver
    Excel 2010
    Posts
    7

    Re: Make VBA Faster

    Yes :D it works how i wanted it to do, thanks guys.

    Now i have one little last question: I want to import a bunch of .xlsx files into one file with different sheets. now i've already put a little code together, but i'm a little bit stuck with it. there are 4 excel files in the specific folder with different names. Is it possible to somehow do what i'm trying to do?

    Please Login or Register  to view this content.

  12. #12
    Forum Expert
    Join Date
    04-22-2013
    Location
    .
    MS-Off Ver
    .
    Posts
    4,418

    Re: Make VBA Faster

    You probably want something along the lines of:
    Please Login or Register  to view this content.

  13. #13
    Registered User
    Join Date
    07-26-2013
    Location
    Graubünden, Switzerland
    MS-Off Ver
    Excel 2010
    Posts
    7

    Re: Make VBA Faster

    yes exactly

    thank you so much for your help

+ 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] Make code run faster
    By ozhunter in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-20-2013, 04:26 AM
  2. Make loop run faster
    By losmi8 in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 02-20-2010, 01:11 AM
  3. How to make macros run faster?
    By naveenvarthaan in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-26-2009, 10:18 AM
  4. [SOLVED] can you make this faster?
    By John in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-25-2005, 04:05 PM

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