Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 396
Default Delete row if 3 columns have empty cells in a row

Hi all, i have a variable length of spreadsheet with columns N, O & P
with names in. There will never be two or three names next to each other
but there are instances when all 3 will be blank ijn the same row, these
are the Rows that i would like to delete. Could somebody help with some
code if possible please...

Thanks in advance

Les Stout

*** Sent via Developersdex http://www.developersdex.com ***
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Delete row if 3 columns have empty cells in a row

Hi Less

Try this for row 1 to 1000

Sub Example2()
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

For Lrow = EndRow To StartRow Step -1

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

Next
End With

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

End Sub

For more info see
http://www.rondebruin.nl/delete.htm




--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"Les Stout" wrote in message ...
Hi all, i have a variable length of spreadsheet with columns N, O & P
with names in. There will never be two or three names next to each other
but there are instances when all 3 will be blank ijn the same row, these
are the Rows that i would like to delete. Could somebody help with some
code if possible please...

Thanks in advance

Les Stout

*** Sent via Developersdex http://www.developersdex.com ***

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 19
Default Delete row if 3 columns have empty cells in a row

On Apr 18, 6:59 pm, "Ron de Bruin" wrote:
Hi Less

Try this for row 1 to 1000

Sub Example2()
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

For Lrow = EndRow To StartRow Step -1

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

Next
End With

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

End Sub

For more info seehttp://www.rondebruin.nl/delete.htm

--

Regards Ron de Bruinhttp://www.rondebruin.nl/tips.htm



"Les Stout" wrote in l...
Hi all, i have a variable length of spreadsheet with columns N, O & P
with names in. There will never be two or three names next to each other
but there are instances when all 3 will be blank ijn the same row, these
are the Rows that i would like to delete. Could somebody help with some
code if possible please...


Thanks in advance


Les Stout


*** Sent via Developersdexhttp://www.developersdex.com***- Hide quoted text -


- Show quoted text -


100% thank you Ron

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default Delete row if 3 columns have empty cells in a row

Sub ABC()
Dim r as Range, lastrow as Long
Dim i as Long
set r = activesheet.UsedRange
lastrow = r.rows.count + r.row - 1

for i = lastrow to 1 step - 1
if application.countBlank(cells(i,"N").Resize(1,3)) = 3 then
rows(i).Delete
end if
Next
End Sub

--
Regards,
Tom Ogilvy


"Les Stout" wrote:

Hi all, i have a variable length of spreadsheet with columns N, O & P
with names in. There will never be two or three names next to each other
but there are instances when all 3 will be blank ijn the same row, these
are the Rows that i would like to delete. Could somebody help with some
code if possible please...

Thanks in advance

Les Stout

*** Sent via Developersdex http://www.developersdex.com ***

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 19
Default Delete row if 3 columns have empty cells in a row

On Apr 18, 6:59 pm, "Ron de Bruin" wrote:
Hi Less

Try this for row 1 to 1000

Sub Example2()
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

For Lrow = EndRow To StartRow Step -1

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

Next
End With

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

End Sub

For more info seehttp://www.rondebruin.nl/delete.htm

--

Regards Ron de Bruinhttp://www.rondebruin.nl/tips.htm



"Les Stout" wrote in l...
Hi all, i have a variable length of spreadsheet with columns N, O & P
with names in. There will never be two or three names next to each other
but there are instances when all 3 will be blank ijn the same row, these
are the Rows that i would like to delete. Could somebody help with some
code if possible please...


Thanks in advance


Les Stout


*** Sent via Developersdexhttp://www.developersdex.com***- Hide quoted text -


- Show quoted text -


Hi Ron, just a question, i assume that it is not possible to use the
xlSpecial cells type option, am i correct ??



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Delete row if 3 columns have empty cells in a row

No, not with more columns to check

--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"Les" wrote in message oups.com...
On Apr 18, 6:59 pm, "Ron de Bruin" wrote:
Hi Less

Try this for row 1 to 1000

Sub Example2()
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

For Lrow = EndRow To StartRow Step -1

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

Next
End With

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

End Sub

For more info seehttp://www.rondebruin.nl/delete.htm

--

Regards Ron de Bruinhttp://www.rondebruin.nl/tips.htm



"Les Stout" wrote in l...
Hi all, i have a variable length of spreadsheet with columns N, O & P
with names in. There will never be two or three names next to each other
but there are instances when all 3 will be blank ijn the same row, these
are the Rows that i would like to delete. Could somebody help with some
code if possible please...


Thanks in advance


Les Stout


*** Sent via Developersdexhttp://www.developersdex.com***- Hide quoted text -


- Show quoted text -


Hi Ron, just a question, i assume that it is not possible to use the
xlSpecial cells type option, am i correct ??

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 396
Default Delete row if 3 columns have empty cells in a row

Amazing, thank you Tom.... always a life saver... :-D

Les Stout

*** Sent via Developersdex http://www.developersdex.com ***
  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 396
Default Delete row if 3 columns have empty cells in a row

Ek het so gedink, Danke Ron. You people are just amazing thanks again...

Les Stout

*** Sent via Developersdex http://www.developersdex.com ***
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
Is there an easy way to delete empty columns? Acanesfan Excel Worksheet Functions 2 September 8th 08 09:01 PM
How to delete at once empty columns in a table? capxc Excel Discussion (Misc queries) 1 July 19th 08 08:28 PM
Delete Rows with Empty Cells with empty column 1 Scott Excel Programming 5 October 2nd 06 11:57 PM
Delete rows with empty cells in columns B&C Richard Excel Discussion (Misc queries) 3 March 18th 06 12:15 AM
Delete empty array columns RB Smissaert Excel Programming 18 August 22nd 04 08:41 PM


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