+ Reply to Thread
Results 1 to 13 of 13

Need to optimize the small macro

  1. #1
    Registered User
    Join Date
    05-27-2010
    Location
    Your sister's house
    MS-Off Ver
    Excel 2007
    Posts
    27

    Need to optimize the small macro

    Please Login or Register  to view this content.
    Ok what I have is 1000 economic scenarios with 60 projection yrs of data with 4 quaterly interest rates for each year. I need to interpolate those 4 quarter rates for each month in the year. This code inserts 2 rows then enters the interpolation formulas above and then autofills across 15 columns. The problem is this needs to be done 240 times for each scenario for 1000 scenarios. I ran this and it took 30minutes to do like 30 scenarios. I need this code to be optimized for maximum speed. Since I'm a beginner, I figure you guys could show me a faster way???
    Last edited by Carnifex930; 03-11-2011 at 08:58 PM.

  2. #2
    Forum Expert
    Join Date
    11-29-2010
    Location
    Ukraine
    MS-Off Ver
    Excel 2019
    Posts
    4,168

    Re: Need to optimize the small macro

    hi, Carnifex930, can you post sample workbook? If you know VB, use arrays it should be quicker

  3. #3
    Registered User
    Join Date
    05-27-2010
    Location
    Your sister's house
    MS-Off Ver
    Excel 2007
    Posts
    27

    Re: Need to optimize the small macro

    Quote Originally Posted by watersev View Post
    hi, Carnifex930, can you post sample workbook? If you know VB, use arrays it should be quicker
    This site won't let me upload. Says I'm missing a security token. No VB knowledge. You think it would be faster if I put everything in an array?

  4. #4
    Forum Expert
    Join Date
    11-29-2010
    Location
    Ukraine
    MS-Off Ver
    Excel 2019
    Posts
    4,168

    Re: Need to optimize the small macro

    I have no doubt about it that it will work faster.

  5. #5
    Forum Expert
    Join Date
    11-29-2010
    Location
    Ukraine
    MS-Off Ver
    Excel 2019
    Posts
    4,168

    Re: Need to optimize the small macro

    please check attachment, run code "test", the output comes on a new sheet, hope this helps
    Attached Files Attached Files

  6. #6
    Registered User
    Join Date
    05-27-2010
    Location
    Your sister's house
    MS-Off Ver
    Excel 2007
    Posts
    27

    Re: Need to optimize the small macro

    Quote Originally Posted by watersev View Post
    please check attachment, run code "test", the output comes on a new sheet, hope this helps
    Thanks! I just ran it, and it did the whole thing in 15 seconds.

    There is no need, as you have done enough already, but if you don't mind putting some comments into the neat code snippet you wrote so us new guys can learn from it. I am somwhat confused by the code as you use a variant, but it never gets declared, and I have never seen ":" notion used in code before. Again youve done enough already, so any extra input is much apreaciated. Thanks.

    Please Login or Register  to view this content.

  7. #7
    Registered User
    Join Date
    03-16-2009
    Location
    Australia
    MS-Off Ver
    Excel 2010
    Posts
    97

    Re: Need to optimize the small macro

    Haha Carnifex!! Im still learning alot of stuff as well tried stepping through the code at run time and still lost trying to figure it out.

    Very Tidy looking code tho Watersev

  8. #8
    Forum Expert
    Join Date
    11-29-2010
    Location
    Ukraine
    MS-Off Ver
    Excel 2019
    Posts
    4,168

    Re: Need to optimize the small macro

    hi, Carnifex, I will try though the comments will be rather short as I do not know how to explain that
    Please Login or Register  to view this content.
    Hope this helps

  9. #9
    Forum Expert
    Join Date
    11-29-2010
    Location
    Ukraine
    MS-Off Ver
    Excel 2019
    Posts
    4,168

    Re: Need to optimize the small macro

    I suggest optimization to my code, please try it, it should be a bit more faster, see attachment
    Attached Files Attached Files

  10. #10
    Forum Expert
    Join Date
    11-29-2010
    Location
    Ukraine
    MS-Off Ver
    Excel 2019
    Posts
    4,168

    Re: Need to optimize the small macro

    if you are happy with the offered solution, please mark the thread as solved (see Forum rules for details)

  11. #11
    Registered User
    Join Date
    05-27-2010
    Location
    Your sister's house
    MS-Off Ver
    Excel 2007
    Posts
    27

    Re: Need to optimize the small macro

    Quote Originally Posted by watersev View Post
    if you are happy with the offered solution, please mark the thread as solved (see Forum rules for details)
    I would love to. Where is the link to mark as solved? I don't see it.

  12. #12
    Registered User
    Join Date
    03-16-2009
    Location
    Australia
    MS-Off Ver
    Excel 2010
    Posts
    97

    Re: Need to optimize the small macro

    Go to the first post you made in the thread click edit and then change the prefix beside the title

  13. #13
    Registered User
    Join Date
    05-27-2010
    Location
    Your sister's house
    MS-Off Ver
    Excel 2007
    Posts
    27

    Re: Need to optimize the small macro

    Quote Originally Posted by radar_jynx View Post
    Go to the first post you made in the thread click edit and then change the prefix beside the title
    Ah thata annoying, the small button the right lets you go to advanced where you can change the prefix.

+ 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