Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 104
Default Delete rows using a macro

Hello,

I need help with a macro that will delete certain rows in a spreadsheet.
The rows that need to be deleted are never in the same place, or the same
number of rows. The thing that the rows I want to delete all have in common
a specific word say "YES" in the same column. But they are never in the same
place everytime.

Please suggest me on this.
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,058
Default Delete rows using a macro

Here is a typical example. The macro deletes any rows with "YES" in column B:

Sub YESMan()
n = Cells(Rows.Count, "B").End(xlUp).Row
For i = n To 1 Step -1
If Cells(i, "B").Value = "YES" Then
Cells(i, "B").EntireRow.Delete
End If
Next
End Sub

--
Gary''s Student - gsnu200855


"Sasikiran" wrote:

Hello,

I need help with a macro that will delete certain rows in a spreadsheet.
The rows that need to be deleted are never in the same place, or the same
number of rows. The thing that the rows I want to delete all have in common
a specific word say "YES" in the same column. But they are never in the same
place everytime.

Please suggest me on this.

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 104
Default Delete rows using a macro

Thanks a ton :)

"Gary''s Student" wrote:

Here is a typical example. The macro deletes any rows with "YES" in column B:

Sub YESMan()
n = Cells(Rows.Count, "B").End(xlUp).Row
For i = n To 1 Step -1
If Cells(i, "B").Value = "YES" Then
Cells(i, "B").EntireRow.Delete
End If
Next
End Sub

--
Gary''s Student - gsnu200855


"Sasikiran" wrote:

Hello,

I need help with a macro that will delete certain rows in a spreadsheet.
The rows that need to be deleted are never in the same place, or the same
number of rows. The thing that the rows I want to delete all have in common
a specific word say "YES" in the same column. But they are never in the same
place everytime.

Please suggest me on this.

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
macro to delete rows Aceensor Excel Discussion (Misc queries) 5 November 14th 08 03:45 PM
Need a macro to delete rows jmr4h8 Excel Discussion (Misc queries) 9 July 2nd 08 11:16 PM
Delete all Rows Macro Wanna Learn Excel Discussion (Misc queries) 5 March 6th 07 10:06 PM
Macro to Delete Certain Rows HROBERTSON Excel Discussion (Misc queries) 2 February 8th 07 09:42 PM
delete rows-macro TUNGANA KURMA RAJU Excel Discussion (Misc queries) 5 January 13th 06 12:01 PM


All times are GMT +1. The time now is 04:53 AM.

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"