Illegal TO in reference to: <name>

One of the following conditions could have caused this error:

  • You specified a range (bound1 To bound2) as a subscript in an array element reference.

    Remove the range; specify a single subscript.

  • You specified a range (bound1 To bound2) as an argument in a call to a procedure.

    Replace the range by a valid argument.

Use ranges in array declarations or ReDim statements only.