darzanmihai Posted July 10, 2008 Posted July 10, 2008 I am trying to make a script that reads some cells from an Excel file and verifies if in any of thes cells is the name "Total", and if there is, it reads cells from that row. The script: #include <ExcelCOM_UDF.au3> $ExcelFile = FileSaveDialog("Alegeti Fisierul", @DesktopDir, "Fisiere tip Excel (*.xls)", 1) _ExcelBookOpen($ExcelFile, 0) _ExcelSheetActivate($ExcelFile, 9) For $i = 29 To 36;rows from 29 to 36 $val = _ExcelReadCell($ExcelFile, $i,1) If $val = "Total" Then; there is only one value ="Total" $j = $i EndIf Next For $i = 2 To 32;columns from 2 to 32 $valoare = _ExcelReadCell($ExcelFile, $j, $i);reads the cells 2,3,...,32 of the row $j $Sheet = _ExcelSheetNameGet($ExcelFile) MsgBox(0, $Sheet & " Linia" & $j & " Coloana" & $i, $valoare) Next _ExcelBookClose($ExcelFile, 0) what am I doing wrong because, even thought the Excel File I used has a cell "Total" within the range of cells the program is veryfying, it returns only nule values. I do not like stupid and idiot people that write idiot things...If you are one, do not write.
darzanmihai Posted July 10, 2008 Author Posted July 10, 2008 I am trying to make a script that reads some cells from an Excel file and verifies if in any of thes cells is the name "Total", and if there is, it reads cells from that row. The script: #include <ExcelCOM_UDF.au3> $ExcelFile = FileSaveDialog("Alegeti Fisierul", @DesktopDir, "Fisiere tip Excel (*.xls)", 1) _ExcelBookOpen($ExcelFile, 0) _ExcelSheetActivate($ExcelFile, 9) For $i = 29 To 36;rows from 29 to 36 $val = _ExcelReadCell($ExcelFile, $i,1) If $val = "Total" Then; there is only one value ="Total" $j = $i EndIf Next For $i = 2 To 32;columns from 2 to 32 $valoare = _ExcelReadCell($ExcelFile, $j, $i);reads the cells 2,3,...,32 of the row $j $Sheet = _ExcelSheetNameGet($ExcelFile) MsgBox(0, $Sheet & " Linia" & $j & " Coloana" & $i, $valoare) Next _ExcelBookClose($ExcelFile, 0) what am I doing wrong because, even thought the Excel File I used has a cell "Total" within the range of cells the program is veryfying, it returns only nule values. My mistake.... forgot to get the right ID of the opened file muttley #include <ExcelCOM_UDF.au3> $ExcelFile1 = FileSaveDialog("Alegeti Fisierul", @DesktopDir, "Fisiere tip Excel (*.xls)", 1) $ExcelFile = _ExcelBookOpen($ExcelFile1, 0) _ExcelSheetActivate($ExcelFile, 9) For $i = 29 To 36;rows from 29 to 36 $val = _ExcelReadCell($ExcelFile, $i,1) If $val = "Total" Then; there is only one value ="Total" $j = $i EndIf Next For $i = 2 To 32;columns from 2 to 32 $valoare = _ExcelReadCell($ExcelFile, $j, $i);reads the cells 2,3,...,32 of the row $j $Sheet = _ExcelSheetNameGet($ExcelFile) MsgBox(0, $Sheet & " Linia" & $j & " Coloana" & $i, $valoare) Next _ExcelBookClose($ExcelFile, 0) I do not like stupid and idiot people that write idiot things...If you are one, do not write.
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