• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

delay in input the value to the array

samsamih

New Member
hi
i have a problem that there is some delay in input the value to the array, and From what I saw the reason is the variable (n1) that i use it an index for the array:

Code:
Public n1 AsInteger
Public changeflag AsBoolean
Public st AsString
Dim arr(1 To 10) AsInteger
PrivateSub Worksheet_Change(ByVal Target As Range) 
If changeflag = TrueThen exit Sub
changeflag = True
If Cells(1, 1).Value <> st Then
st = Cells(1, 1).Value 
n1 = n1 + 1 
EndIf


arr(n1)=*number*     the number updated by the formula i wrote............... ' there is a delay in input the number to the array (the reason is the n1)

Cells(1,2).resize(ubound(arr)).value=application.transpose(arr)
Changeflag = False
End Sub

the n1 Causes slowness the macro , but i need it for the array (the index), and the n1 added to it one only when the cells(1,1) changed ,
so is there a way to get the index(n1) without to cause delay for the macro(array)?



many thanks
 
Back
Top