Hi Guy's


Need your help in this code.. in the following code...





Sub Time_Test_Array2()



Range("K1") = Now()

Application.ScreenUpdating = False



Range("E:E").Clear

LastRow = 0

LastRow = Range("A1000000").End(xlUp).Row

iVal = Range("A1:A" & LastRow).Value

ReDim strArray(1 To UBound(iVal))



For i = LBound(iVal) To UBound(iVal)

    If iVal(i, 1) Mod 2 = 0 Then

        strArray(i) = "Even Number"

    Else: strArray(i) = "Odd Number"

    End If



Next i



Range(Cells(LBound(strArray), 5), Cells(UBound(strArray), 5)).Value =
strArray

'Range(Cells(LBound(iVal), 5), Cells(UBound(iVal), 5)) = iVal



ActiveSheet.Range("K2") = Now()

End Sub



Suppose there’re some numbers given on column “A”, I want to print whether
the number is Odd or Even in column “E” using Arrays, my code is working but
printing wrong values, instead of printing “Even Number” for an even number
it is printing “Odd Number”, there can be a logical error in the code.



All The Best.. J



Thanks & Regards

Deepak

-- 
----------------------------------------------------------------------------------
Some important links for excel users:
1. Follow us on TWITTER for tips tricks and links : 
http://twitter.com/exceldailytip
2. Join our LinkedIN group @ http://www.linkedin.com/groups?gid=1871310
3. Excel tutorials at http://www.excel-macros.blogspot.com
4. Learn VBA Macros at http://www.quickvba.blogspot.com
5. Excel Tips and Tricks at http://exceldailytip.blogspot.com
 
To post to this group, send email to excel-macros@googlegroups.com

<><><><><><><><><><><><><><><><><><><><><><>
Like our page on facebook , Just follow below link
http://www.facebook.com/discussexcel

Reply via email to