nooneclose Posted August 15, 2018 Posted August 15, 2018 (edited) My program has to first search for names in Column D that do not match up with column C. I got that search to work using arrays. It was slow and I could not figure out how to delete them so I just manually put coded the names that do not belong. I found their cell location but I do not know how to store that location and delete it. This is what I have so far. Local $NameToDelete1[6] = _Excel_RangeFind($OpenWorkbook, "Smith, Bill") _ArrayDisplay($NameToDelete1, "Excel UDF: _Excel_RangeFind Example 1", "", 0, "|", "Sheet|Name|Cell|Value|Formula|Comment") _Excel_RangeDelete($OpenWorkbook.ActiveSheet, $NameToDelete1[2], $xlShiftUp) Please help, I wanted to have this program done yesterday but I did not see this problem until yesterday. Edited November 1, 2018 by nooneclose
water Posted August 15, 2018 Posted August 15, 2018 Just to make sure I understand your problem: You have an Excel Workbook where you want to delete all rows where the value in column D doe not match the value in column C of the same row? My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
nooneclose Posted August 15, 2018 Author Posted August 15, 2018 (edited) @water I was actually able to figure this one out on my own. But if you have a better way please share. As of now, this is what I use: Local $NameToDelete1 = _Excel_RangeFind($OpenWorkbook, "Smith, Bob") Local $Name = $NameToDelete1[0][3] Local $NameCell = $NameToDelete1[0][2] Local $CellNumber = StringSplit($NameCell, "A, B, C, D, E") Local $CellRange = $NameCell & ":E" & $CellNumber[2] _Excel_RangeDelete($OpenWorkbook.ActiveSheet, $CellRange, $xlShiftUp) I have to manually make the code for every name, (that I know of) that should not be on the roster. I would greatly appreciate it if the program would search for me for any name in column D that is not found in column C and then delete that cell (upwards) which holds the name in column D and their time in column E. Edited August 15, 2018 by nooneclose
IAMK Posted August 15, 2018 Posted August 15, 2018 Does it need to be AutoIT? If not, you can do it in Excel: https://stackoverflow.com/questions/14613609/how-to-delete-row-based-on-cell-value Just replace the search for "-" to be a comparison between C and D.
nooneclose Posted August 20, 2018 Author Posted August 20, 2018 @IAMK Yes, it has to be done in AutoIt. That is the whole point of creating an automation script, to make the program do something that I do not want to. Like I said earlier though I have already figured out how to accomplish this task plus I have refined the process since then.
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