Deleting redundant records

H

Hayley

Hi. I have a list of 10,000 plus rows with several
headings over columns A to L. I want to delete any row
that contains an incomplete record, which means here any
record in which column F is blank. Is it possible to do
this without having to go through the list deleting rows
manually, and is it possible to do it in a way that
deletes the whole row (moving the list up) rather than
just the data (so leaving gaps in the list). Many thanks
if you can help.

Hayley
 
F

Frank Kabel

Hi
one way:
- apply a filter (Data - Filter Autofilter')
- filter for blank rows
- delete these rows
- remove the filter
 
C

Chip Pearson

Hayley,

Try some code like the following:

Sub DeleteRows()
Dim LastRow As Long
Dim RowNdx As Long
LastRow = Cells(Rows.Count, "A").End(xlUp).Row
For RowNdx = LastRow To 2 Step -1
If Cells(RowNdx, "F").Value = "" Then
Rows(RowNdx).Delete
End If
Next RowNdx
End Sub


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
 
G

Guest

Thanks. Not well enough up on code to give it a go but
Frank's suggestion worked so I'm happy. Very grateful to
you both.

Hayley
 

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

Top