View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Mandeep Baluja Mandeep Baluja is offline
external usenet poster
 
Posts: 25
Default Query for Array !!!

Here comes a Question,Hope someone has done it before.

Scenario :- This macro is doing checking the Range of 1 lac rows by putting into an array and marking the last column as wrong if any negative entry comes in any column,This would be done for all rows one by one(Ya by Array),

What to achieve as always i want to remove this if condition and making this macro a effective one,Ya question comes how?, This can be possible when this macro check all the columns for a single row in one time not one by one cell value, I have seen evaluate function works in these kind of scenario where you need to work with output only.

something like Evaluate(Min(Lbound(Varout,2),ubound(varout,2)) <0 then mark wrong in column G !!,I am not sure how evaluate works here but any help would be appreciated basically i want to see the logics of different minds.

1) I can do it with the help of helper column but i don't

Sub Array1()


Dim varout() As Variant
varout = Range("A1:K100000")

t = Timer
temp = 0
ReDim Preserve varout(1 To 100000, 1 To 13)

For i = LBound(varout) To UBound(varout)
For j = LBound(varout, 2) To UBound(varout, 2)
'Debug.Print varout(i, j)
If varout(i, j) < 0 Then
Sheets("sheet1").Range("L" & i).Value = "wrong"
End If
Next
' MsgBox temp
Next

MsgBox Timer - t
End Sub