Home |
Search |
Today's Posts |
#1
![]() |
|||
|
|||
![]()
Good afternoon, I am very new to VBA and was hoping if anyone code tell me why the following code only loops once. (I am just testing some stuff out in it). The message boxes are to see how many time it loops, but they both respond with 1.
Sub ref() Dim RefNum(0 To 9) As String Dim RefFound As Range Dim wk As Workbook Dim i, count As Integer RefNum(0) = "100617" RefNum(1) = "100203" RefNum(2) = "105522" RefNum(3) = "105774" RefNum(4) = "105199" RefNum(5) = "100514" RefNum(6) = "105207" RefNum(7) = "107065" RefNum(8) = "101957" RefNum(9) = "101394" count = 0 Set wk = Workbooks.Open(ThisWorkbook.Path & "\2005 Hourly by Res cleaned.xlsx") wk.Sheets("Hourly").Activate For i = 0 To i = 9 Set RefFound = Cells.Find(What:=RefNum(i), After:=ActiveCell, LookIn:=xlValues, LookAt _ :=xlWhole, SearchOrder:=xlByColumns, SearchDirection:=xlNext, MatchCase:= _ False, SearchFormat:=False) count = count + 1 Next MsgBox (count) MsgBox (i) End Sub Thanks in advance for answers |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Sum of yes answers | Excel Worksheet Functions | |||
multiple answers | Excel Worksheet Functions | |||
Please help me with answers | Excel Discussion (Misc queries) | |||
new user with easy question? not easy for me | New Users to Excel | |||
Does anyone know the answers to | Links and Linking in Excel |