apoliemans Posted July 26, 2013 Posted July 26, 2013 See below script based on example _ExcelWriteSheetFromArray.au3. If I do the same in COM (see bottom lines added by me) , a transpose of the array seems to be required to get the same result. Can someone explain? Local $oExcel = _ExcelBookNew() ;Declare the Array Local $aArray[5][2] = [["LocoDarwin", 1],["Jon", 2],["big_daddy", 3],["DaleHolm", 4],["GaryFrost", 5]] ;0-Base Array ;Paste array into sheet1 $oExcel.ActiveWorkBook.Sheets(1).Activate _ExcelWriteSheetFromArray($oExcel, $aArray, 1, 1, 0, 0) ;Paste same array into sheet2 gives unexpected result $oExcel.ActiveWorkBook.Sheets(2).Activate $oExcel.Activesheet.Cells(1,1).Resize(5,2) = $aArray ;Only after transposing first the array is pasted properly ;$oExcel.Activesheet.Cells(1,1).Resize(5,2) = $oExcel.WorksheetFunction.Transpose($aArray)
Solution LeppyR64 Posted July 30, 2013 Solution Posted July 30, 2013 Excel deals with column names as the predominant dimension. Notice that whenever you reference a cell in a formula it is "A1", "C6", "CN28", etc.
apoliemans Posted July 30, 2013 Author Posted July 30, 2013 @LeppyR64, now it makes sense, thanks for explaining. Andre
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now