Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default Help with a "delete rows" Macro

Hey guys, can anyone help me with a macro I just cannot get worked
out. I have a simple "delete Blank rows" Macro, however the "Blank"
cell is just the result of an "IF" function that returns a "" or blank
cell. However the cell still holds the equation so it is not deleting
the rows, even though they are blank (just not technically). I would
like to know how I can get the macro below (or any other ideas you may
have) to delete all the rows that return a False calculation due to an
IF function, that uses columns A-G as the search method. I have copied
my current macro below.

Sub Macro3()
'
' Macro3 Macro
' Macro recorded 4/20/2007 by fletchej
'
Columns("A:C").Select
Selection.SpecialCells(xlCellTypeBlanks).EntireRow .Delete
ActiveSheet.UsedRange

'
End Sub

Any explanation in a simplified form would be much appreciated,
sometimes I get lost in all the code.

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,624
Default Help with a "delete rows" Macro

One way:

Public Sub DeleteRowsWithBlanksInColumnsAthroughG()
Dim rDelete As Range
Dim rCell As Range

With ActiveSheet
For Each rCell In Intersect(.Columns(1), .UsedRange)
With rCell.Resize(1, 7)
If Application.CountIf(.Cells, vbNullString) 0 Then
If rDelete Is Nothing Then
Set rDelete = .Cells
Else
Set rDelete = Union(rDelete, .Cells)
End If
End If
End With
Next rCell
If Not rDelete Is Nothing Then rDelete.EntireRow.Delete
End With
End Sub


In article .com,
NewUser22 wrote:

Hey guys, can anyone help me with a macro I just cannot get worked
out. I have a simple "delete Blank rows" Macro, however the "Blank"
cell is just the result of an "IF" function that returns a "" or blank
cell. However the cell still holds the equation so it is not deleting
the rows, even though they are blank (just not technically). I would
like to know how I can get the macro below (or any other ideas you may
have) to delete all the rows that return a False calculation due to an
IF function, that uses columns A-G as the search method. I have copied
my current macro below.

Sub Macro3()
'
' Macro3 Macro
' Macro recorded 4/20/2007 by fletchej
'
Columns("A:C").Select
Selection.SpecialCells(xlCellTypeBlanks).EntireRow .Delete
ActiveSheet.UsedRange

'
End Sub

Any explanation in a simplified form would be much appreciated,
sometimes I get lost in all the code.

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
"Last Cell" to find last row, but can't delete blank rows [email protected] Excel Discussion (Misc queries) 6 January 8th 07 11:50 PM
Delete Rows that Contain the Text "Total" and vice versa SteveC Excel Programming 7 January 25th 06 07:11 PM
Search for the word "continued", if found, delete that row + 10 rows above jriendeau5[_4_] Excel Programming 0 November 5th 04 03:00 PM
Search for the word "continued", if found, delete that row + 10 rows above jriendeau5 Excel Programming 1 November 5th 04 02:24 AM
Search "Total" in all worksheets and delete rows containing "Total" mk_garg20 Excel Programming 2 July 30th 04 06:42 AM


All times are GMT +1. The time now is 01:19 PM.

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"