ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Links and Linking in Excel (https://www.excelbanter.com/links-linking-excel/)
-   -   Macro for deleting rows and serialising the remaing rows (https://www.excelbanter.com/links-linking-excel/209995-macro-deleting-rows-serialising-remaing-rows.html)

Srinivasulu Bhattaram

Macro for deleting rows and serialising the remaing rows
 
Macro for deleting rows and serialising the remaing rows
================================================== ==

I have a spread sheet

It's a ToDo List



The structure is like this

Column A Sl No

Column B Task

Column C Person

Column D Completed



To start with I keep entering the tasks in one stretch and take a print out.

The first Column (A) will be a serialized.

I wil be using this print out for few days.

After two/three days, I would like to open the spread sheet and enter fresh
tasks

For all completed tasks I put x in Col D.

What I currently require is a macro to



1.. Remove all rows where Column D contains 'x" (quotes not included.)
2.. After this operation, contents of Column A will have to be serialsed.


seena




---
avast! Antivirus: Outbound message clean.
Virus Database (VPS): 081111-0, 11/11/2008
Tested on: 11/12/2008 5:59:36 PM
avast! - copyright (c) 1988-2008 ALWIL Software.
http://www.avast.com




Bill Manville

Macro for deleting rows and serialising the remaing rows
 
Not sure why you chose the Links group for this post - Programming
would be more appropriate, but anyway your macro would be something
like this:

Sub CleanUp()
' assumes the data starts at A1 and has titles in row 1
Dim lRow As Long
With Range("A1").CurrentRegion
For lRow = .Rows.Count To 2 Step -1
If .Cells(lRow, 4)="x" then .Rows(lRow).Delete shift:=xlUp
Next
.Sort key1:=Range("A1"), order1:=xlAscending, header:=xlYes
End With
End Sub

Bill Manville
MVP - Microsoft Excel, Oxford, England
No email replies please - respond to newsgroup



All times are GMT +1. The time now is 07:49 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com