View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Tamsen Tamsen is offline
external usenet poster
 
Posts: 2
Default Annoying delete empty rows question

SpecialCells works fine if I am selecting rows to delete based on a
criteria of a blank cell in 1 column, as soon as I try to make this
judgement based on 2 columns it does not work.

Data format is such

Row 1 Column A Column B Column C
Row 2 data data
Row 3 data data
Row 4
Row 5 data data data
Row 6 data data

So I'm doing an auto filter on Column A and Column B to look for
blanks in the 2 columns ONLY - and then figure out how to select those
rows. In the example above, I want it to delete Row 4 only.

OR - I use the SpecialCells suggestion below:-
Columns("A:B").Activate
Cells.SpecialCells(xlCellTypeBlanks).EntireRow.Del ete - this is the
line that does not work. I get a run time error "'1004' - cannot use
that command on overlapping sections'.

If I change the above to say just Columns("A:A") or ("B:B") it does
delete based on that criteria, but doesn't work for my purposes (it
deletes row 4 and row 3, or row 4 and row 6.)

Still a newbie, and still need some guidance :(

Many thanks in advance
"Don Guillett" wrote in message ...
look in vba help for specialcells

"Tamsen" wrote in message
om...
Hi there - please forgive the newbie question, I've been searching
around on these boards for an answer and nothing seems to quite fit.

Scenario:-
I have a worksheet template (although not an .xlt file) that multiple
people will be using as a basis to add their own data into. (i.e. the
amount of data varies per workbook).

I want to make sure that people don't leave blank rows (based on at
least 2 columns of info).

So - I have been going down the autofilter route, and I get to the
point where I have all the blank rows based on 2 columns displayed
fine.

My question is - how can I automate the selection of a variable amount
of blank rows to delete them?

Ideally I would love a VBA solution, as I'll have approx 18
spreadsheets to complete this on at least 2 or 3 times a week...
URGH!