Sam137 Posted December 12, 2011 Share Posted December 12, 2011 Hello All I have an array which is declared as Local $aArray[5]. And I load some values in the array elements. Local $aArray[0] = ["Test1+000"] or it may be spaces Local $aArray[1] = ["Test2+001"] or it may be spaces Local $aArray[2] = ["Test3+002"]or it may be spaces Local $aArray[3] = ["Test4+003"]or it may be spaces At the end i want to write a particular cell Only the array elements which is NOT spaces. If $aArray[0] <> "" or $aArray[1] <> "" or $aArray[2] <> "" or $aArray[3] <> ""Then _ExcelWriteArray($oExcel, 10, 5, $aArray) End If For example: Local $aArray[0] = "" Local $aArray[1] = ["Test2+001"] Local $aArray[2] = "" Local $aArray[3] = ["Test4+003"] The from the above coding i need to get the result as below stored in the cell 10,5 in the excel: Test2+001 @newline Test4+003 How can i attain this? When i execute the coding which is mentioned above it says, Subscript has incorrect values or exceeded. Pls help. Link to comment Share on other sites More sharing options...
Jfish Posted December 12, 2011 Share Posted December 12, 2011 Could you please post your actual code? Also, I don't think you want to use _ExcelWriteArray because that will write the entire array - not an element of the array. Wouldn't you be better of with _ExcelWriteCell where $value == $aArray[0] or whichever element was "true" under your if test? In such case, if you have multiple elements - perhaps best to create a single string as in: $myString = $aArray[1] & @crlf & $aArray[3]. Then you could _ExcelWriteCell that $myString value ... again, haven't tried it but I think it could work ... Build your own poker game with AutoIt: pokerlogic.au3 | Learn To Program Using FREE Tools with AutoIt Link to comment Share on other sites More sharing options...
enaiman Posted December 12, 2011 Share Posted December 12, 2011 For every cell, build a string to hold the desired elements, then write that string to the cell. Basic example: Dim $arr [3] = ["123", "", "234"] $str = "" For $i = 0 To UBound($arr)-1 If $arr[$i] <> "" Then $str &= $arr[$i]&@CRLF EndIf Next MsgBox(0, "string", $str) SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script wannabe "Unbeatable" Tic-Tac-Toe Paper-Scissor-Rock ... try to beat it anyway :) Link to comment Share on other sites More sharing options...
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