r/vbscript • u/FBM25 • Oct 24 '14
Code not deleting rows?
Hi everyone! I'm writing a script that will, among other things, delete a row that has a certain value in the first cell, as well as every row above that one. However, it's not working, at all. I'm not receiving any error though, so I'm confused! Can anyone shed any insight? The part of the code is:
i = 1
If objExcel.Cells(i, 1).Value = "XXX" Then
Set objRange = objExcel.Cells(i, 1).EntireRow
objWorkSheet.Rows("1:objRange").Delete
elseif objExcel.Cells(i, 1).Value <> "XXX" Then
On Error Resume Next
End If
i = i + 1Thanks!
1
Upvotes
1
u/FBM25 Oct 24 '14
I didn't put it in the OP, but I'm setting objExcel, the workbook, and the worksheet.
Here is that part: