Excel row in array (problemmit variable)

  • dies ist der teil er ärger macht.
    in der drittletzten zeile geht der ärger los. wenn ich $sspalte nutze bekomme ich die fehlermelung

    Code
    C:\Program Files\AutoIt3\Include\Excel.au3 (694) : ==> The requested action with this object has failed.:
    Return $oExcel.Activesheet.Cells($sRangeOrRow, $iColumn).Value
    Return $oExcel.Activesheet.Cells($sRangeOrRow, $iColumn)^ ERROR


    wenn ich jedoch eine zahl eingebe ist alles ok. ich kann jedoch keine zahl eingeben, da sich das format der excel tabelle scheinbar jeden tag nach laune des erstelles ändert.


    ideen?


    [autoit]

    $aArray = _ExcelReadSheetToArray($oExcel, 2) ; Benutzt die vorgegebenen Parameter
    #region --- CodeWizard generated code Start ---
    ;MsgBox features: Title=Yes, Text=Yes, Buttons=OK, Icon=Critical, Modality=Task Modal, Miscellaneous=Top-most attribute
    MsgBox(270352, "Welche Spalte (Namen)?", "Schau im nächsten Fenster wo die Namen stehen und Merke dir die Spalte (Senkrecht)")
    #endregion --- CodeWizard generated code Start ---
    _ArrayDisplay($aArray, "Welche Spalte?")
    $namenspalte = InputBox("Welche Spalte?", "In welcher Spalte Standen die namen?")

    [/autoit][autoit][/autoit][autoit]

    $menge = UBound($aArray)
    MsgBox(0, "reihen", $menge)
    For $i = 0 To $menge - 1
    GUICtrlSetData($uInput[$i] - 1, $aArray[$i][$namenspalte])
    Next
    Dim $test[30]
    #region --- CodeWizard generated code Start ---
    ;MsgBox features: Title=Yes, Text=Yes, Buttons=OK, Icon=Critical, Modality=Task Modal, Miscellaneous=Top-most attribute
    MsgBox(270352, "Welche Spalte?", "Schau im nächsten Fenster wo die Softwarepakete stehen und Merke dir die Spalte (Senkrecht)")
    #endregion --- CodeWizard generated code Start ---
    _ArrayDisplay($aArray, "Welche Spalte? (Software)")
    $sspalte = InputBox("Welche Spalte?", "In welcher Spalte Standen die Softwarepakete?")
    MsgBox(0, "", "-" & $sspalte & "-")
    For $j = 1 To $menge - 1;Loop
    $sCellValue = _ExcelReadCell($oExcel, $j, $sspalte)
    $softarray[$j] = $sCellValue
    Next

    [/autoit]

    I spent 10 minutes reviewing code and thinking "What kind of drugs is this guy on?" before realizing it was something I wrote.

    Einmal editiert, zuletzt von Maximus1 (8. Mai 2012 um 08:22)

  • eine InputBox gibt ja einen String zurück.
    Probier mal:

    [autoit]

    For $j = 1 To $menge - 1;Loop
    $sCellValue = _ExcelReadCell($oExcel, $j, Int($sspalte))
    $softarray[$j] = $sCellValue
    Next

    [/autoit]


    Übriegens kannst du bei der For-Schleife wieder $i nehmen, nur wenn du Schleifen verschachtelst musst du andere Variablen nehmen.

  • die lösung kann ja so einfach sein :(
    ich frage mich warum ich sowas immer übersehe.


    ich danke dir für deinen tip. :)

    I spent 10 minutes reviewing code and thinking "What kind of drugs is this guy on?" before realizing it was something I wrote.