LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 360
Default delete a cell with a null value in column n

There are some values in cells in column "M" that are blank. If the cell is
null or blank I want to delete the entire row. I borrowed this script and I
don't understand what the "Is Nothing" stands for. Does it stand for "null"?
How can I fix it to delete the rows I don't need.

thanks,



-----------code----------------
Sub deleteRows()

Dim Rng As Range
Dim rngToSearch As Range
Dim rngToDelete As Range


With ActiveSheet
Set rngToSearch = .Range(.Range("M1"), .Cells(Rows.Count, "M").End(xlUp))
End With

For Each Rng In rngToSearch
If IsNull Then
If rngToDelete Is Nothing Then
Set rngToDelete = Rng
Else
Set rngToDelete = Union(rngToDelete, Rng)
End If
End If
Next Rng

If Not rngToDelete Is Nothing Then rngToDelete.EntireRow.Delete

End Sub
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
how can I return the value of the first not null cell in a column NHH Excel Discussion (Misc queries) 7 August 19th 08 02:14 PM
Delete Null/Blank Rows Theresa Excel Discussion (Misc queries) 8 December 18th 07 05:17 AM
cell value based on null/not null in another cell spence Excel Worksheet Functions 1 February 18th 06 11:49 PM
Populating column N with a formula if column A is Null or Blank Steve Excel Programming 4 September 28th 04 01:50 PM
searching for a null cell in a column FutureWiz Excel Programming 4 January 8th 04 09:56 AM


All times are GMT +1. The time now is 08:34 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"