Results 1 to 3 of 3

Slow code execution

Threaded View

  1. #1
    Registered User
    Join Date
    02-04-2005
    Posts
    6

    Slow code execution

    I have faced very strange problem with the following code:

    Type C_data
    D As Date
    T As Double
    A As String
    B As String
    R As Byte
    C As String
    PR As Double
    P As Byte
    End Type

    Public Carray(150000) As C_data
    ---------------------------------------------
    Count=1
    Application.ScreenUpdating = False
    For i = StartPos To Cnt
    Cells(Count, 1).Value = Carray(i).D
    Cells(Count, 2).Value = Carray(i).T
    Cells(Count, 3).Value = Carray(i).A
    Cells(Count, 4).Value = Carray(i).B
    Cells(Count, 5).Value = Carray(i).R
    Cells(Count, 6).Value = Carray(i).C
    Count = Count + 1
    Next i
    Application.ScreenUpdating = True
    ---------------------------------------------

    This code works ok with a workbook containing one worksheet. It takes about 15 secs for 50000 records. But on my actual workbook I have several sheets and same code for the same 50000 records is executed for more than 3 minutes. I have figured out that this is influenced by two sheets containing about 6000 cells with comments. I have removed all comments and the problem has gone. But I need those sheets with comments
    Does anyone has any ideas why it happens?
    Last edited by side_; 10-21-2005 at 11:04 AM.

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