Macro for deleting rows and serialising the remaing rows

  • Thread starter Srinivasulu Bhattaram
  • Start date


Srinivasulu Bhattaram

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

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.


avast! Antivirus: Outbound message clean.
Virus Database (VPS): 081111-0, 11/11/2008
Tested on: 11/12/2008 6:00:16 PM
avast! - copyright (c) 1988-2008 ALWIL Software.



Roger Govier

Hi Seena

This should do what you want

Sub RemoveCompletedRows()
Dim i As Long, lr As Long

lr = ActiveSheet.UsedRange.Rows.Count
For i = lr To 2 Step -1
If UCase(Cells(i, "D")) = "X" Then
End If
Next i
lr = ActiveSheet.UsedRange.Rows.Count
For i = 1 To lr - 1
Cells(i + 1, "A") = i
Next i

End Sub

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question