Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Junior Member
 
Posts: 1
Default Macro to delete entire rows where certain range of cells are blank

I'm looking for some help. I have looked around online but I can't quite find the macro I need.

Basically, in a table, every row has a value in Columns A:C.

Certain rows have values from D:N however, some rows are completely blank between D:N.

What I want to do is completely delete any row in its entirety, if columns D:N are blank. I have a manual workaround but really a macro is what I'm looking for.

Can anyone help please!?

Last edited by cameron4987 : June 26th 12 at 12:21 PM
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 621
Default Macro to delete entire rows where certain range of cells are blank

Sub DeleteRows_If_D_to_N_MT()
Dim lRow As Long
Dim CalcMode As Long
Dim ViewMode As Long
Dim StartRow As Long
Dim EndRow As Long

With Application
CalcMode = .Calculation
.Calculation = xlCalculationManual
.ScreenUpdating = False
End With

ViewMode = ActiveWindow.View
ActiveWindow.View = xlNormalView

With ActiveSheet
.DisplayPageBreaks = False
StartRow = 1
EndRow = 1000 'adjust to suit

For lRow = EndRow To StartRow Step -1

If Application.CountA(.Range(.Cells(lRow, "D"), _
.Cells(lRow, "N"))) = 0 Then .Rows(lRow).Delete

Next
End With

ActiveWindow.View = ViewMode
With Application
.ScreenUpdating = True
.Calculation = CalcMode
End With

End Sub


Gord

On Tue, 26 Jun 2012 11:17:11 +0000, cameron4987
wrote:


I'm looking for some help. I have looked around online but I can't quite
find the macro I need.

Basically, in a table, every row has a value in Columns A:C.

Certain rows have values from D:N however, some rows are completely
blank between D:N.

What I want to do is completely delete any row in its entirety, if
columns D:N are blank. I have a manual workaround but really a macro is
what I'm looking for.

Can anyone help please!?

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 587
Default Macro to delete entire rows where certain range of cells areblank

hi Cameron,

Sub Macro1()
Dim n As Integer, i As Long
For i = Range("A65536").End(xlUp).Row To 1 Step -1
n = Evaluate("CountA(D" & i & ":N" & i & ")")
If n = 0 Then Rows(i).Delete ' or Rows(i).Delete Shift:=xlUp
Next
End Sub


--
isabelle



Le 2012-06-26 07:17, cameron4987 a écrit :
I'm looking for some help. I have looked around online but I can't quite
find the macro I need.

Basically, in a table, every row has a value in Columns A:C.

Certain rows have values from D:N however, some rows are completely
blank between D:N.

What I want to do is completely delete any row in its entirety, if
columns D:N are blank. I have a manual workaround but really a macro is
what I'm looking for.

Can anyone help please!?




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
How can I selectivly delte rows with a macro ? Dan Thompson Excel Programming 7 February 16th 10 03:58 PM
MACRO HELP - deleting rows containing a range of blank cells DavidHawes Excel Discussion (Misc queries) 9 February 26th 07 03:40 PM
delte multiple blank rows in excel Steve Dont know how George Excel Worksheet Functions 8 October 7th 06 12:15 AM
macro to delete entire rows when column A is blank ...a quick macro vikram Excel Programming 4 May 3rd 04 08:45 PM
Delte blank rows between different sections of data Steven R. Berke Excel Programming 2 July 27th 03 01:06 AM


All times are GMT +1. The time now is 06:40 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"