Macro to delete

N

NoviceIan

Hi, I've never used Macros in Excel before and need to start now.

Basically every so often I receive a list of patients from GP practices in
Excel documents. The list is dumped in from GP systems and often needs
sorting. The main problem with the lists is that there are often several
empty rows between each patient.

We use these lists for mail merge purposes and the blank rows cause havoc.
I would like to create a macro that will search through the patients and
delete the empty rows. I tried using the code from one of the other threads.
It did what I wanted but I could not stop it.

Please can somebody help.

Thanks

Ian
 
B

Bob Phillips

Sub myMacro()
Dim rng As Range
Set rng = Range("A1").Resize(Cells(Rows.Count, "A"). _
End(xlUp).Row).SpecialCells(xlCellTypeBlanks)
rng.Delete
End Sub

This assumes that column A is the key column.

--

HTH

RP
(remove nothere from the email address if mailing direct)
 

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