Some of your variables are misspelled, others are undefined... I don't have VB on hand right now, but try this:
Public Function prime(ByVal x As Integer)
Dim primes(0) As Integer
Dim bound, y, Index As Integer
primes(0) = 2
For y = 2 To x
bound = UBound(primes)
For Index = 0 To bound
If (y Mod primes(Index)) = 0 Then
Exit For
End If
Next Index
If Index = bound Then
ReDim Preserve primes(bound + 1)
primes(bound + 1) = y
End If
Next y
End Function