The creation and customization of database applications using Microsoft Access
After decomposing the statement:
Set RangeMatrixA = AnyWorkSheet.range(AnyWorkSheet.Cells(1, 1), AnyWorkSheet.Cells(MatDim, MatDim)).Cells
into single parts:
Set r1 = AnyWorkSheet.Cells(1)
Set r2 = AnyWorkSheet.Cells(5, 5)
Set r2 = AnyWorkSheet.Cells(MatDim, MatDim)
Set r3 = AnyWorkSheet.range(r1, r2)
Set RangeMatrixA = r3.Cells
it fails in: Set r2 = AnyWorkSheet.Cells(MatDim, MatDim)
It turns out that the variable MatDim cannot be of the "byte" type (as it is in the definition of the Sub).
If Cint(MatDim) is used instead - then it works....
And I can even specify the first cell just with one parameter: AnyWorkSheet.Cells(1)
I cant find the data type requirement for the "Cells" parameters - but converting to Integer works...