Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
Ayo Ayo is offline
external usenet poster
 
Posts: 489
Default Need Help with ActiveCell.EntireRow.Delete

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


  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 396
Default Need Help with ActiveCell.EntireRow.Delete

You need to start from below, then work upwards:


Private Sub cmdCopy_Click()

Dim ClastRow As Integer, c As Range, l As Long

Application.ScreenUpdating = False

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 l = ClastRow To 2 Step -1

If Range("E" & l).Value < Worksheets("Sheet1").Range("I16").Value
Then
Rows(l).Delete
End If
Next c

Application.ScreenUpdating = True

End Sub



--
Wigi
http://www.wimgielis.be = Excel/VBA, soccer and music


"Ayo" wrote:

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


  #3   Report Post  
Posted to microsoft.public.excel.misc
Ayo Ayo is offline
external usenet poster
 
Posts: 489
Default Need Help with ActiveCell.EntireRow.Delete

Someone suggested that yesteray and I tried it but I still ended up with the
same problem.

"Wigi" wrote:

You need to start from below, then work upwards:


Private Sub cmdCopy_Click()

Dim ClastRow As Integer, c As Range, l As Long

Application.ScreenUpdating = False

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 l = ClastRow To 2 Step -1

If Range("E" & l).Value < Worksheets("Sheet1").Range("I16").Value
Then
Rows(l).Delete
End If
Next c

Application.ScreenUpdating = True

End Sub



--
Wigi
http://www.wimgielis.be = Excel/VBA, soccer and music


"Ayo" wrote:

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


  #4   Report Post  
Posted to microsoft.public.excel.misc
Ayo Ayo is offline
external usenet poster
 
Posts: 489
Default Need Help with ActiveCell.EntireRow.Delete

Thanks Wigi.
I was able to modify your code and now it looks like its working.

"Wigi" wrote:

You need to start from below, then work upwards:


Private Sub cmdCopy_Click()

Dim ClastRow As Integer, c As Range, l As Long

Application.ScreenUpdating = False

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 l = ClastRow To 2 Step -1

If Range("E" & l).Value < Worksheets("Sheet1").Range("I16").Value
Then
Rows(l).Delete
End If
Next c

Application.ScreenUpdating = True

End Sub



--
Wigi
http://www.wimgielis.be = Excel/VBA, soccer and music


"Ayo" wrote:

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


  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 396
Default Need Help with ActiveCell.EntireRow.Delete

OK;, well done Ayo.

--
Wigi
http://www.wimgielis.be = Excel/VBA, soccer and music


"Ayo" wrote:

Thanks Wigi.
I was able to modify your code and now it looks like its working.

"Wigi" wrote:

You need to start from below, then work upwards:


Private Sub cmdCopy_Click()

Dim ClastRow As Integer, c As Range, l As Long

Application.ScreenUpdating = False

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 l = ClastRow To 2 Step -1

If Range("E" & l).Value < Worksheets("Sheet1").Range("I16").Value
Then
Rows(l).Delete
End If
Next c

Application.ScreenUpdating = True

End Sub



--
Wigi
http://www.wimgielis.be = Excel/VBA, soccer and music


"Ayo" wrote:

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


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Need Help with ActiveCell.EntireRow.Delete Ayo Excel Discussion (Misc queries) 8 July 19th 08 04:45 PM
ListBox1. add item myCell.entirerow Vikram Dhemare Excel Discussion (Misc queries) 3 April 8th 08 01:49 AM
If activecell.column = variable then activecell,offset (0,1) Battykoda via OfficeKB.com Excel Discussion (Misc queries) 1 October 2nd 07 08:05 PM
ActiveCell or ActiveSheet Launchnet Excel Worksheet Functions 1 July 20th 07 07:46 PM
delete entirerow if date more than 12months old flow23 Excel Discussion (Misc queries) 1 May 25th 06 03:32 PM


All times are GMT +1. The time now is 11:09 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"