Jump to content

Recommended Posts

Posted

so I would like to know is there any way to delete  rows with specific number in excel without disturbing other cells using autoit 

example 10 rows are present and 6 rows have the number 3 and the rest is other number I want to delete of all the 3 s

Posted (edited)

I can use macro to filter but the problem come when I want to delete cause I get huge documents with different ranges and have to sort them I need a program that deletes for example.

colum B has 300 from rows 20 to 60 and the rest is other numbers I want to completely remove the range that has 300 and it is  different for different documents.

Edited by yasha
Posted

Here are a couple of methods to do it:

#include <Array.au3>
#include <Excel.au3>

Local $oExcel = _Excel_Open()
Local $oWorkbook = _Excel_BookOpen($oExcel, @ScriptDir & "\Book1.xlsx")

MsgBox(4096, "Remove Range B20:B60", "Delete Range B20 to B60")
For $i = 60 To 20 Step - 1
    _Excel_RangeDelete($oWorkbook.ActiveSheet, "B" & $i, $xlShiftUp, 1)
Next

MsgBox(4096, "Remove All Instances", "Removes all rows with 300 in B:B Range")
Local $aRangeFind = _Excel_RangeFind($oWorkbook, 300, "B:B", Default, $xlWhole)
For $i = UBound($aRangeFind) - 1 To 0 Step - 1
    _Excel_RangeDelete($oWorkbook.ActiveSheet, $aRangeFind[$i][2], $xlShiftUp, 1)
Next

 

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...