AUTOMATIC DELETE

  • Thread starter Thread starter zebra
  • Start date Start date
Z

zebra

Could anyone please tell me how to write a sub() to automatically delete
null numval lines in a sheet viz
sub DelNul()
Dim Cell As Range
For Each Cell In Sheets("'Sheet1").UsedRange
If Sheets("Sheet1").Range(Cell.Address).value - vbNullString Then
Delete Line 'OR SOMETHING LIKE THIS?
Else
End If
Next
End Sub
 
Your looping over all cells in the usedrange and if any of them are blank,
deleting the entire row.

if that is what you want to do, simpler would be:

Dim rng as Range
set rng = Sheets("Sheet1").Cells.Specialcells(xlblanks).EntireRow
if not rng is nothing then
rng.delete
End if
 

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

Back
Top