Sign in to follow this  
Followers 0
Ram

Array dimension range Exceeded calling from Excel.

2 posts in this topic

Hi,

I have few data in an excel that has around 313 Rows and 10 columns each. All the rows have the same personal data but different age.

I have created a array such that all these rows are written on the array first and then I use the array later in the script using a for loop 1 to 313.

Here is what I do:

$oExcel = _ExcelBookOpen("C:\dataEntry.xls")

$aColumnA = _ExcelReadArray($oExcel, 1, 1, 7, 1)

$aColumnB = _ExcelReadArray($oExcel, 1, 2, 7, 1)

$aColumnC = _ExcelReadArray($oExcel, 1, 3, 7, 1)

$aColumnD = _ExcelReadArray($oExcel, 1, 4, 7, 1)

$aColumnE = _ExcelReadArray($oExcel, 1, 5, 7, 1)

$aColumnF = _ExcelReadArray($oExcel, 1, 6, 7, 1)

$aColumnG = _ExcelReadArray($oExcel, 1, 7, 7, 1)

$aColumnH = _ExcelReadArray($oExcel, 1, 8, 7, 1)

$aColumnI = _ExcelReadArray($oExcel, 1, 9, 7, 1)

$aColumnJ = _ExcelReadArray($oExcel, 1, 10, 7, 1)

For loop works just fine on until 6th row is entered. When it starts the 7th Row. I get the below error:

C:\dataentry.au3 (206) : ==> Array variable has incorrect number of subscripts or subscript dimension range exceeded.:

$Filepath = "C:\" & $aColumnB[$i] & $aColumnD[$i]

$Filepath = "C:\" & ^ ERROR

What is wrong?

Awaiting your response!

Share this post


Link to post
Share on other sites



Hi Ram,

Where do these UDFs come from?

Arrays in AutoIt are 0 based so perhaps you should not exceed 212 when you have 213 elements in your array. Try to use

For $i = 0 To UBound($aColumnB) -1

to get the upper limit of the array.

:)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0