Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Deleting entire rows based on certain criteria

Is there a way to automatically delete any row that has a 0 in both of
specified columns (i.e. BF and BG)?

Thanks for any help

--
Message posted from http://www.ExcelForum.com

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,885
Default Deleting entire rows based on certain criteria

Hi
try the following macro:
Sub delete_rows()
Dim lastrow As Long
Dim row_index As Long
Application.ScreenUpdating = False
lastrow = ActiveSheet.Cells(Rows.Count, "A").End(xlUp).Row
For row_index = lastrow - 1 To 1 Step -1
If Cells(row_index, "BF").Value= 0 and _
Cells(row_index, "BG").Value= 0 then
Rows(row_index).delete
End If
Next
Application.ScreenUpdating = True
End Sub

--
Regards
Frank Kabel
Frankfurt, Germany


Is there a way to automatically delete any row that has a 0 in both
of 2 specified columns (i.e. BF and BG)?

Thanks for any help.


---
Message posted from http://www.ExcelForum.com/

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
deleting entire rows with the same cell value in the first column Pedro F. Excel Discussion (Misc queries) 3 January 11th 06 07:10 PM
Deleting rows based on multiple criteria Sandip Shah Excel Programming 3 July 12th 04 01:57 PM
Deleting entire rows Ed C[_3_] Excel Programming 2 June 18th 04 02:14 PM
Deleting rows based on cell criteria jgranda Excel Programming 1 April 27th 04 06:41 PM
Deleting rows based on criteria John Walker[_2_] Excel Programming 2 December 12th 03 08:37 PM


All times are GMT +1. The time now is 06:44 PM.

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

About Us

"It's about Microsoft Excel"