CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5

Thread: Speed up VB

  1. #1
    Join Date
    Jun 2000
    Location
    Germany
    Posts
    448

    Speed up VB

    Hello!

    I am developing a COM Add-In for Excel. Now I have the following problem. I write around 2000 lines with 20 columns of data (most are references to another sheet) to an excel worksheet. I cannot write the whole data set at one time. Impossible (too long to explain for now). The problem is that the more data is on the sheet the longer it takes to create new lines. At the end it takes nearly a minute to create the data.

    How can I speed this up? Any ideas?

    Thank you in advance for your help!

    --------------------------------------------------
    Visit our new forum: www.maxcode.com
    Feel free to contact me via ICQ# 82806695

  2. #2
    Join Date
    Dec 1999
    Location
    Dublin, Ireland
    Posts
    1,173

    Re: Speed up VB

    Do you have derived cells on the sheet? i.e. running totals or averages or whatever - if so, add these after the data set has been populated.

    -------------------------------------------------
    Ex. Datis: Duncan Jones
    Merrion Computing Ltd
    http://www.merrioncomputing.com
    '--8<-----------------------------------------
    NEW -The printer usage monitoring application
    '--8<------------------------------------------

  3. #3
    Join Date
    Jun 2000
    Location
    Germany
    Posts
    448

    Re: Speed up VB

    No...

    Its the following: I have one sheet with languages (4 columns) one column contains the current language and if another language is selected this columns is filled with one of the other columns contents... follow?

    And on the other sheet there are cells which refer to the current language column in the other sheet.

    Understand what I am talking about?

    --------------------------------------------------
    Visit our new forum: www.maxcode.com
    Feel free to contact me via ICQ# 82806695

  4. #4
    Join Date
    Jun 2000
    Location
    Germany
    Posts
    448

    Re: Speed up VB

    I think that is a redraw problem. The excel window is redrawn every time a line is inserted into the sheet. Can I prevent redrawing until my generating process is finished?

    --------------------------------------------------
    Visit our new forum: www.maxcode.com
    Feel free to contact me via ICQ# 82806695

  5. #5
    Join Date
    Jan 2000
    Location
    Olen, Belgium
    Posts
    2,477

    Re: Speed up VB

    Try setting the EnableCalculation property of the sheet to false, insert all your rows, and set it back to true. Then call the Calculate method of the sheet.

    Tom Cannaerts
    [email protected]

    Programming today is a race between software engineers striving to build bigger and better idot-proof programs, and the universe trying to produce bigger and better idiots. So far, the universe is winning -- Rich Cook
    Tom Cannaerts
    email: [email protected]
    www.tom.be (dutch site)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured