NewtonScripter Posted July 17, 2008 Share Posted July 17, 2008 Currently I am using the ExcelCOM_UDF to edit my excel files. I have written a formula on a sheet, but I want to copy the result, not the formula to another sheet. The only way I know how to do that is copy and paste(value). I don't see the function that can do soemthing like that Does anyone know if that is possible with the current version of ExcelCOM_UDF? Link to comment Share on other sites More sharing options...
PsaltyDS Posted July 18, 2008 Share Posted July 18, 2008 Currently I am using the ExcelCOM_UDF to edit my excel files. I have written a formula on a sheet, but I want to copy the result, not the formula to another sheet. The only way I know how to do that is copy and paste(value). I don't see the function that can do soemthing like that Does anyone know if that is possible with the current version of ExcelCOM_UDF? I think your difference is between COPY/PASTE and READ/WRITE. Note the output from this demo: #include <ExcelCOM_UDF.au3> $oExcel = _ExcelBookNew() _ExcelWriteCell($oExcel, "Original", "A1") _ExcelWriteCell($oExcel, 1, "A2") _ExcelWriteCell($oExcel, 2, "A3") _ExcelWriteFormula($oExcel, "=SUM(A2:A3)", "A4") _ExcelWriteCell($oExcel, "Copy/Paste", "B1") _ExcelWriteCell($oExcel, 10, "B2") _ExcelWriteCell($oExcel, 20, "B3") _ExcelCopy($oExcel, "A4") _ExcelPaste($oExcel, "B4") _ExcelWriteCell($oExcel, "Read/Write", "C1") _ExcelWriteCell($oExcel, 100, "C2") _ExcelWriteCell($oExcel, 200, "C3") $sFormula = _ExcelReadCell($oExcel, "A4") _ExcelWriteCell($oExcel, $sFormula, "C4") $sValue = _ExcelReadCell($oExcel, "A4") ConsoleWrite("Debug: Original: $sValue = " & $sValue & @LF) $sValue = _ExcelReadCell($oExcel, "B4") ConsoleWrite("Debug: Copy/Paste: $sValue = " & $sValue & @LF) $sValue = _ExcelReadCell($oExcel, "C4") ConsoleWrite("Debug: Read/Write: $sValue = " & $sValue & @LF) _ExcelBookClose($oExcel, 0, 0) If you COPY the cell, you copy the formula (which also translates the formula to the new column). If you READ then WRITE the cell, you get just the data. muttley Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law 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