Expected 'In'

You created a For EachNext block, but did not include the In keyword in the first line. The following demonstrates the correct structure of a For EachNext block.

                      For Each element In group
   [statements]
   [Exit For]
   [statements]
Next [element]

To correct this error

  • Make sure that the For EachNext block includes all the necessary parts.

See Also

Reference

For Each...Next Statement

Do...Loop Statement

Exit Statement

For...Next Statement

While...Wend Statement