-1

I keep getting this error when I try to do InStr for some strange reason... I have done this before and it has worked the other times, but for some reason I am unable to get this to work... Done the run-through and I know it is the InStr function that is giving me an issue

For x = 0 To 3466 Step 1
    For y = 0 To 6391 Step 1
        If InStr(Sheet1.Cells(x, 1).Value, Sheet2.Cells(y, 1).Value) <> 0 Then
            Sheet3.Cells(i, 1).FormulaR1C1 = Sheet1.Cells(x, 5).Value
            i = i + 1
        End If
    Next y
Next x

Any help is appreciated. I even tried getting the values separately but that didn't work either.

Community
  • 1
  • 1
Adjit
  • 10,134
  • 12
  • 53
  • 98

1 Answers1

1

Well... I'm an idiot... I just needed to change the starting values from 0 to 1, because row 0 doesn't exist

Adjit
  • 10,134
  • 12
  • 53
  • 98
  • I had to discard my answer :P – Siddharth Rout Jan 06 '14 at 17:06
  • Also you don't need `Step 1`. It won't make a difference. – Siddharth Rout Jan 06 '14 at 17:07
  • @SiddharthRout Thanks for the effort, and the pointer! Side note: you get a chance to look at the file in use problem? made a few changes but same issue happened http://stackoverflow.com/questions/20705870/file-in-use-message-stopping-overnight-run-of-visual-basic-excel-script – Adjit Jan 06 '14 at 17:10