There are 2 ways to do this.
Using the Mod Operator - Solution 1
If the pattern is always N+3, starting at 2, then you could use the VBA Mod operator. Your macro would look something like this:
i = 8
If i Mod 3 = 2 Then
x = (i + 1) / 3
Because the variable i as manually entered and the mod is always equal to 2, you can determine how far into the sequence you are using some arithmetic expressions.
Storing the Sequence in an Array - Solution 2
You could also create a constant array function to store the sequence if the sequence is short enough. Then you would loop through that sequence searching for a match. Once you find it, store the index of the match in variable x. Here's a neat little VBA macro that does just that:
i = 2
For j = LBound(ConstantArray) To UBound(ConstantArray)
If i = ConstantArray(j) Then x = j + 1
Private Function ConstantArray()
ConstantArray = Array(2, 5, 8, 11)
Run the ArraySequence macro to see it in action. Notice the ConstantArray is in a standalone function because you can't declare constant arrays using the VBA Const keyword.