Nilkimas Posted November 30, 2022 Share Posted November 30, 2022 Hi all, I was wondering if someone can help me out. For my ongoing project I need to automate work in a tool. I have figured most of it out. Originally the script is in AutoHotKey but for reasons AutoIt is better. There are several things I need to do in an Excel file. 1. I need to check for the first empty cell - This to know up to where to process it. 2. Check one cell with the one below it, in case they are the same, I will need to loop the process in the tool 3. I need to take column A value, paste it somewhere, run through a process, then depending on the result of 2, write column D in subsequent fields. Then following that I need to go to the next row. I have had a look at the _Excel_RangeRead function in the Excel.au3, but I am struggling to figure out how to make the range work with a variable. Any help would be greatly appreciated. Link to comment Share on other sites More sharing options...
AutoBert Posted November 30, 2022 Share Posted November 30, 2022 Link to comment Share on other sites More sharing options...
Nilkimas Posted December 1, 2022 Author Share Posted December 1, 2022 Thank you for the pointer, sadly it doesn't help with the main issue of going through the file one line at a time, but I can use an Array for that. It'll take a little figuring out I think. But I should manage. Link to comment Share on other sites More sharing options...
water Posted December 1, 2022 Share Posted December 1, 2022 Maybe this wiki page sheds some light onto the subject. My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
water Posted December 1, 2022 Share Posted December 1, 2022 21 hours ago, Nilkimas said: I have had a look at the _Excel_RangeRead function in the Excel.au3, but I am struggling to figure out how to make the range work with a variable. Please post the code you used, the value of @error and @extended after after calling _Excel_RangeRead and the result you get (nothing, wrong result ...) My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
Nilkimas Posted December 1, 2022 Author Share Posted December 1, 2022 (edited) I'm trying to find how to get the values contained within a cell... The wiki page has a lot of information on how to get the range, but I can't seem to find the way to get the content. In AutoHotKey I used the following: A2 := test.ActiveSheet.cells.(Line,2).FormulaR1C1 to format a variable based on the content to then write/paste elsewhere. Edited December 1, 2022 by Nilkimas Link to comment Share on other sites More sharing options...
Solution water Posted December 1, 2022 Solution Share Posted December 1, 2022 I do not know AutoHotKey but I think in AutoIt your statement should look like: Global $vCellR1C1 ; Formula of the read cell Global $oWorkbook ; Object of the Excel workbook to process Global $iLine ; Line number to read ; AutoHotKey:test.ActiveSheet.cells.(Line,2).FormulaR1C1 $vCellR1C1 = $oWorkbook.ActiveSheet.Cells($iLine,2).FormulaR1C1 My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
Nilkimas Posted December 1, 2022 Author Share Posted December 1, 2022 That did it, thank you water. Really appreciate it. 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