Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 360
Default only deletes first row with a blank cell in column "M" con't

It actually deletes the first two rows with "M" cells blank. This is a guess
but it seemed to stop deleting/checking rows on a cell where the one above it
was blank also?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,939
Default only deletes first row with a blank cell in column "M" con't

Do you have a formula that is returning Blank??? If so then that code won't
work and you will need a loop or something similar...
--
HTH...

Jim Thomlinson


"Janis" wrote:

It actually deletes the first two rows with "M" cells blank. This is a guess
but it seemed to stop deleting/checking rows on a cell where the one above it
was blank also?

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,939
Default only deletes first row with a blank cell in column "M" con't

Are the cells truely empty or do they have blank spaces in them. Give this a
try...

Select Column M - F5 - Special Cells - Blanks

If and or what gets highlighted?
--
HTH...

Jim Thomlinson


"Janis" wrote:

It actually deletes the first two rows with "M" cells blank. This is a guess
but it seemed to stop deleting/checking rows on a cell where the one above it
was blank also?

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,939
Default only deletes first row with a blank cell in column "M" con't

How about this. It should delete all of the blank whether they are the result
of a formula or if the cell contains blank spaces... It is similat to waht
you first posted...

Sub DeleteBlanks()
Dim rngToSearch As Range
Dim rng As Range
Dim rngToDelete As Range

With ActiveSheet
On Error Resume Next
Columns("M").SpecialCells(xlCellTypeBlanks).Entire Row.Delete
On Error GoTo 0

Set rngToSearch = .Range(.Range("M1"), .Cells(Rows.Count, "M").End(xlUp))
For Each rng In rngToSearch
If Trim(rng.Value) = "" Then
If rngToDelete Is Nothing Then
Set rngToDelete = rng
Else
Set rngToDelete = Union(rng, rngToDelete)
End If
Next rng
If Not rngToDelete Is Nothing Then rngToDelete.EntireRow.Delete
End With
End Sub
--
HTH...

Jim Thomlinson


"Jim Thomlinson" wrote:

Do you have a formula that is returning Blank??? If so then that code won't
work and you will need a loop or something similar...
--
HTH...

Jim Thomlinson


"Janis" wrote:

It actually deletes the first two rows with "M" cells blank. This is a guess
but it seemed to stop deleting/checking rows on a cell where the one above it
was blank also?

Reply
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
Excel - Golf - how to display "-2" as "2 Under" or "4"as "+4" or "4 Over" in a calculation cell Steve Kay Excel Discussion (Misc queries) 2 August 8th 08 01:54 AM
only deletes first row with a blank cell in column "M" Janis Excel Programming 1 July 18th 07 11:34 PM
What is a function in VBA EXCEL witch finds a string like "not" in cell and then deletes a row with this cell? [email protected] Excel Programming 7 November 14th 05 09:13 AM
What is a function in VBA EXCEL witch finds a string like "not" in cell and then deletes a row with this cell? [email protected] Excel Worksheet Functions 3 November 14th 05 01:48 AM
Changing "returned" values from "0" to "blank" LATATC Excel Worksheet Functions 2 October 20th 05 04:41 PM


All times are GMT +1. The time now is 02:51 AM.

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

About Us

"It's about Microsoft Excel"