when you say it is a challenge; then you have to have your own good answer.
Sub Time_Test_Array2() Dim DatRng As Range, LastRow As Long Dim r As Long, i As Long Application.ScreenUpdating = False Range("E:E, K1:K3").Clear Range("K1") = Timer LastRow = Cells(Rows.Count, 1).End(xlUp).Row Set DatRng = Range("A1:A" & LastRow) For i = 1 To DatRng.Rows.Count If DatRng(i, 1) Mod 2 = 0 Then Cells(i, 5) = "Event Number" Else Cells(i, 5) = "Odd Number" End If Next i Range("K2") = Timer Range("K3") = Timer - Range("K1") End Sub On Sun, Apr 24, 2011 at 9:13 PM, Deepak Pal Singh <deepaktheind...@gmail.com > wrote: > 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
ctv_Even and Odd.xls
Description: MS-Excel spreadsheet