Writing an array values to cells is slow more than msgbox
i have a problem with writing the result of the macro (the array) to the cells of the sheet its done slow whitch cause to be miss value at the cell
the code :
Public n1 As Integer
Public changeflag as boolean
public st as string
dim arr(1 to 10) as integer
Private Sub Worksheet_Change(ByVal Target As Range)
If changeflag = true then exit sub
changeflag = true
If Cells(1, 1).Value <> st Then
st = Cells(1, 1).Value
n1 = n1 + 1
End If
arr(n1)=*number* ' the number updated by the formula i wrote..................... ' until this point all is ok
cells(n1,2).value=arr(n1) - ' the main problem
Changeflag = false
End Sub
the problem at the command *cells(n1,2).value=arr(n1)* that should write the value of the array arr(n1) to the cell(n1,2) , but what is haapend that the value of the array is written to the cell in delay which cause to be miss data ,
i tried to chnage the command and i wrote " msgbox arr(n1)" to check if the problem is the array or the writing to the cell, and its worked ok without any delay or miss data, but i need to see the value of the array in the cells of the sheet whithout delay , how can i solve this problem any idea please?
many thanks
Recent comments
5 years 36 weeks ago
6 years 22 weeks ago
6 years 34 weeks ago
6 years 37 weeks ago
6 years 38 weeks ago
6 years 43 weeks ago
6 years 52 weeks ago
7 years 2 days ago
7 years 3 days ago
7 years 3 days ago