Consider Below Excel:
Id Col1 Col2 Col3 Col4
25 s p n
11 a t x g
17 r t
10 a a e
66 a a
Suppose I have an array which contains the Id numbers
e.g. Arr=(25,11,66)
Is it possible to delete all the rows where the Id number is in that array at once?
Do I need to select them first?
CODE:
Option Explicit
Dim arr,objExcel1,strPathExcel1,objSheet1
Set objExcel1 = CreateObject("Excel.Application")'Object for Condition Dump
strPathExcel1 = "D:\VA\Test.xlsx"
objExcel1.Workbooks.open strPathExcel1
Set objSheet1 = objExcel1.ActiveWorkbook.Worksheets(4)
arr = Array(5,11,66)
objSheet1.Range("A" & Join(arr, ",A")).EntireRow.Delete
ERROR "Unknown Runtime Error" -- I am getting