LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Junior Member
 
Posts: 4
Default Easy answers for anyone

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Sum of yes answers Linda L Excel Worksheet Functions 2 December 23rd 09 06:04 PM
multiple answers AndyS Excel Worksheet Functions 3 October 16th 06 09:14 AM
Please help me with answers Michael Wiredu Excel Discussion (Misc queries) 2 August 24th 06 05:39 PM
new user with easy question? not easy for me speakeztruth New Users to Excel 5 June 3rd 05 09:40 PM
Does anyone know the answers to DK Links and Linking in Excel 0 May 23rd 05 11:14 PM


All times are GMT +1. The time now is 04:14 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"