spacecodeur
spacecodeur

Reputation: 2406

Very simple set value of array cell, program very slow when he writes on specify column

I am using a continuous and old professional program. My program builds several simple data arrays and writes the array to an excel cell like this:

Sheets("toto").Cells(4,i) = "blabla"

But for one value of i, the write time is very long and I don't understand why.

Here is my code :

...
For No_Bug = 0 To Indtab - 1
    If mesComments(No_Bug) <> "" Then
        Sheets(feuille_LBT).Cells(Ligne_Bug, 1) = Ligne_Bug - 5
        Sheets(feuille_LBT).Cells(Ligne_Bug, 2) = mesID_Test(No_Bug)
        Sheets(feuille_LBT).Cells(Ligne_Bug, 3) = mesResultats(No_Bug)
        Sheets(feuille_LBT).Cells(Ligne_Bug, 4) = mesComments(No_Bug)
        Sheets(feuille_LBT).Cells(Ligne_Bug, 5).FormulaLocal = mesScreens(No_Bug)
        Sheets(feuille_LBT).Cells(Ligne_Bug, 6) = 2 'If I comment only this line, the programm is fast, ifnot the programm is very slow (~1, 2 secondes per loop), What the hell ??? xD
        Sheets(feuille_LBT).Cells(Ligne_Bug, 7) = 1
End If 
...

Upvotes: 0

Views: 61

Answers (1)

anefeletos
anefeletos

Reputation: 702

Is this cell referenced from other cells? Check if any complicated computations related with this cell.

Upvotes: 1

Related Questions