I have this error some time on my web app testing the app

Unhandled OutOfBoundsException
Message: Attempted to access cell -1,1 but limit is -1,3.


I guess you’re trying to access a cell in a listbox that does not exist.
Do you have a Listbox somewhere?

I get that error sometimes if I have the following conditions in a listbox…

  • code written in the selectionchanged event
  • at run something selected in a listbox with a row highlighted.
  • I choose to delete all rows associated with that listbox.

To correct for this I simply add the following IF…THEN statement in the selectionchanged event to make sure that the listindex of the listbox is not -1 before executing the code.

Sub SelectionChanged()
If Me.ListIndex >-1 Then
// execute code

end if
End Sub