Search the Community
Showing results for tags 'excelrangewrite'.
-
Not sure what's going on with my script, but when I range read the contents in column A and then write them to column E it inserts the contents but it also inserts #N/A after all the way down to row 1048576. What am I missing from my script? Below is my script
-
Hello dear forum user! I try to make an algorithm that reads values from 2 predefined columns until it founds 2 empty cells in that column, if that happens, It should write a SUM function in to the cell after the last read value. It should do this until it founds 3 empty cells. (I order my excel before this part, so these criteriums should work, and they do while I'm testing). Now, I just found a little logical bump on the $SUMsor variable, but I corrected it. Since MsgBox shows me that the readings are good, and the string it should write are also good, and no error flags are detected, I'm not sure what to do next. I'm pretty sure it is attached to the right excel, since every other things works, and it also reads in from the excel It should. Here is my code snippet: ;CONSTRUCTION----------------------------------- ;TO DO: ;Range insert to SULY and HUF, put it in Bold $CellaOlvasoSzamlalo = $CellNumb + 1 Do Local $SUMSor = $CellNumb + 1 ;will be used to determine the "top of the area which it should SUM, CellNumb is the row where the headers/titels were found Local $SULYolvaso1 = _Excel_RangeRead($ExcelObject, Default, $SULYoszlop & $CellaOlvasoSzamlalo) ;Read MsgBox($MB_SYSTEMMODAL, "Értesítés", "$SULYolvaso1:" & $SULYolvaso1 & "") ;Check what is read Local $SULYolvaso2 = _Excel_RangeRead($ExcelObject, Default, $SULYoszlop & $CellaOlvasoSzamlalo + 1) MsgBox($MB_SYSTEMMODAL, "Értesítés", "$SULYolvaso2:" & $SULYolvaso2 & "") Local $SULYolvaso3 = _Excel_RangeRead($ExcelObject, Default, $SULYoszlop & $CellaOlvasoSzamlalo + 2) MsgBox($MB_SYSTEMMODAL, "Értesítés", "$SULYolvaso3:" & $SULYolvaso3 & "") Select Case $SULYolvaso2 = "" and $SULYolvaso3 = "" _Excel_RangeWrite($ExcelObject, $ExcelObject.Activesheet, "=SUM(" & $SULYoszlop & $SUMSor & ":" & $SULYoszlop & $CellaOlvasoSzamlalo & ")") If @error Then Exit MsgBox($MB_SYSTEMMODAL, "Excel UDF: _Excel_RangeWrite Example 1", "Error writing to worksheet." & @CRLF & "@error = " & @error & ", @extended = " & @extended) MsgBox($MB_SYSTEMMODAL, "Értesítés", "Suly oszlop: " & "=SUM(" & $SULYoszlop & $SUMSor & ":" & $SULYoszlop & $CellaOlvasoSzamlalo & ")") _Excel_RangeWrite($ExcelObject, $ExcelObject.Activesheet, "=SUM(" & $sHUFBeszurOszlop & $SUMSor & ":" & $sHUFBeszurOszlop & $CellaOlvasoSzamlalo & ")") If @error Then Exit MsgBox($MB_SYSTEMMODAL, "Excel UDF: _Excel_RangeWrite Example 1", "Error writing to worksheet." & @CRLF & "@error = " & @error & ", @extended = " & @extended) MsgBox($MB_SYSTEMMODAL, "Értesítés", "Suly oszlop: " & "=SUM(" & $sHUFBeszurOszlop & $SUMSor & ":" & $sHUFBeszurOszlop & $CellaOlvasoSzamlalo & ")") $SUMSor = $CellaOlvasoSzamlalo + 3 EndSelect $CellaOlvasoSzamlalo = $CellaOlvasoSzamlalo + 1 Until $SULYolvaso1 = "" and $SULYolvaso2 = "" and $SULYolvaso3 = "" ;$ExcelObject.Activesheet.Range(String($sHUFBeszurOszlop) & $CellaOlvasoSzamlalo).Font.Bold = True ;----------------------------------------------- Also I would like to write it in bold, I have en example commented out at the end, but is there a way with range insert to insert in Bold? Thank you for your help and insight! and have a nice day
- 8 replies
-
- noerror
- _excel_rangewrite
-
(and 1 more)
Tagged with: