A
Ayo
I have this subroutine that is supose to look through the cells in a column
and if the cell value is equal to the value in a cell in another sheet, the
entire row is to be deleted. I have about 2807 rows in the sheet. The problem
I am having is that, this seem to work for about half of the rows. I should
have 332 rows left after this operation but I have 1403 rows because most of
the rows that should have been deleted are not.
Any ideas what is going on.
Private Sub cmdCopy_Click()
Dim ClastRow As Integer, c As Range
Worksheets("BulkUploadReport 1 ").Delete
Windows("BulkUploadReport 1 .xls").Activate
Sheets("BulkUploadReport 1 ").Select
Sheets("BulkUploadReport 1 ").Copy After:=Workbooks("Vista.xls").Sheets(1)
Sheets("BulkUploadReport 1 ").Select
ClastRow = ActiveSheet.UsedRange.Rows.Count
For Each c In ActiveSheet.Range("E2:E" & ClastRow).Cells
c.Activate
If c <> Worksheets("Sheet1").Range("I16").Value Then
ActiveCell.EntireRow.Delete
End If
Next c
End sub
and if the cell value is equal to the value in a cell in another sheet, the
entire row is to be deleted. I have about 2807 rows in the sheet. The problem
I am having is that, this seem to work for about half of the rows. I should
have 332 rows left after this operation but I have 1403 rows because most of
the rows that should have been deleted are not.
Any ideas what is going on.
Private Sub cmdCopy_Click()
Dim ClastRow As Integer, c As Range
Worksheets("BulkUploadReport 1 ").Delete
Windows("BulkUploadReport 1 .xls").Activate
Sheets("BulkUploadReport 1 ").Select
Sheets("BulkUploadReport 1 ").Copy After:=Workbooks("Vista.xls").Sheets(1)
Sheets("BulkUploadReport 1 ").Select
ClastRow = ActiveSheet.UsedRange.Rows.Count
For Each c In ActiveSheet.Range("E2:E" & ClastRow).Cells
c.Activate
If c <> Worksheets("Sheet1").Range("I16").Value Then
ActiveCell.EntireRow.Delete
End If
Next c
End sub