Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 34
Default delete rows if cell in row contains "a" or "o" or empty

I want to delete the entire rows if a cell in column F contains "a" or
"o" or empty.
Then I also want to delete the rows which are in a range of row 10 to
25.

I already made something but I cannot manage to only look in the range
row 10 to 25.

Sub Example()
Dim Lrow As Long
Dim CalcMode As Long
Dim StartRow As Long
Dim EndRow As Long
With Application
CalcMode = .Calculation
.Calculation = xlCalculationManual
.ScreenUpdating = False
End With
With ActiveSheet
.DisplayPageBreaks = False
StartRow = 1
EndRow = .Cells(.Rows.Count, "F").End(xlUp).Row
For Lrow = EndRow To StartRow Step -1
If IsError(.Cells(Lrow, "F").Value) Then
ElseIf .Cells(Lrow, "F").Value = "a" Or .Cells(Lrow,
"F").Value = "o" Or .Cells(Lrow, "F").Value = ""
Then .Rows(Lrow).Delete
End If
Next
End With
With Application
.ScreenUpdating = True
.Calculation = CalcMode
End With
End Sub

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default delete rows if cell in row contains "a" or "o" or empty

Sub Example()
Dim Lrow As Long
Dim CalcMode As Long
Dim StartRow As Long
Dim EndRow As Long
With Application
CalcMode = .Calculation
.Calculation = xlCalculationManual
.ScreenUpdating = False
End With
With ActiveSheet
.DisplayPageBreaks = False
.Rows("10:25").Delete
StartRow = 1
EndRow = .Cells(.Rows.Count, "F").End(xlUp).Row
For Lrow = EndRow To StartRow Step -1
If not IsError(.Cells(Lrow, "F").Value) Then
.Cells(Lrow, "F").Value = "a" Or _
.Cells(Lrow,"F").Value = "o" Or _
.Cells(Lrow, "F").Value = "" Then

.Rows(Lrow).Delete
End If
Next
End With
With Application
.ScreenUpdating = True
.Calculation = CalcMode
End With
End Sub


"bartman1980" wrote:

I want to delete the entire rows if a cell in column F contains "a" or
"o" or empty.
Then I also want to delete the rows which are in a range of row 10 to
25.

I already made something but I cannot manage to only look in the range
row 10 to 25.

Sub Example()
Dim Lrow As Long
Dim CalcMode As Long
Dim StartRow As Long
Dim EndRow As Long
With Application
CalcMode = .Calculation
.Calculation = xlCalculationManual
.ScreenUpdating = False
End With
With ActiveSheet
.DisplayPageBreaks = False
StartRow = 1
EndRow = .Cells(.Rows.Count, "F").End(xlUp).Row
For Lrow = EndRow To StartRow Step -1
If IsError(.Cells(Lrow, "F").Value) Then
ElseIf .Cells(Lrow, "F").Value = "a" Or .Cells(Lrow,
"F").Value = "o" Or .Cells(Lrow, "F").Value = ""
Then .Rows(Lrow).Delete
End If
Next
End With
With Application
.ScreenUpdating = True
.Calculation = CalcMode
End With
End Sub


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 34
Default delete rows if cell in row contains "a" or "o" or empty

On 31 okt, 17:08, Joel wrote:
Sub Example()
Dim Lrow As Long
Dim CalcMode As Long
Dim StartRow As Long
Dim EndRow As Long
With Application
CalcMode = .Calculation
.Calculation = xlCalculationManual
.ScreenUpdating = False
End With
With ActiveSheet
.DisplayPageBreaks = False
.Rows("10:25").Delete
StartRow = 1
EndRow = .Cells(.Rows.Count, "F").End(xlUp).Row
For Lrow = EndRow To StartRow Step -1
If not IsError(.Cells(Lrow, "F").Value) Then
.Cells(Lrow, "F").Value = "a" Or _
.Cells(Lrow,"F").Value = "o" Or _
.Cells(Lrow, "F").Value = "" Then

.Rows(Lrow).Delete
End If
Next
End With
With Application
.ScreenUpdating = True
.Calculation = CalcMode
End With
End Sub



"bartman1980" wrote:
I want to delete the entire rows if a cell in column F contains "a" or
"o" or empty.
Then I also want to delete the rows which are in a range of row 10 to
25.


I already made something but I cannot manage to only look in the range
row 10 to 25.


Sub Example()
Dim Lrow As Long
Dim CalcMode As Long
Dim StartRow As Long
Dim EndRow As Long
With Application
CalcMode = .Calculation
.Calculation = xlCalculationManual
.ScreenUpdating = False
End With
With ActiveSheet
.DisplayPageBreaks = False
StartRow = 1
EndRow = .Cells(.Rows.Count, "F").End(xlUp).Row
For Lrow = EndRow To StartRow Step -1
If IsError(.Cells(Lrow, "F").Value) Then
ElseIf .Cells(Lrow, "F").Value = "a" Or .Cells(Lrow,
"F").Value = "o" Or .Cells(Lrow, "F").Value = ""
Then .Rows(Lrow).Delete
End If
Next
End With
With Application
.ScreenUpdating = True
.Calculation = CalcMode
End With
End Sub- Tekst uit oorspronkelijk bericht niet weergeven -


- Tekst uit oorspronkelijk bericht weergeven -


I ment to delete only the rows at rows 10 to 25 IF the letters a or o
or nothing are in column F

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
Look for cell containing "Initial" then if the next cell after equals "Final" then delete both rows. [email protected][_2_] Excel Programming 3 September 28th 07 01:45 PM
change "true" and "false" to "availble" and "out of stock" inthestands Excel Worksheet Functions 2 July 19th 07 07:05 PM
HELP on "left","right","find","len","substitute" functions serene83 Excel Discussion (Misc queries) 5 June 27th 06 02:23 AM
Count occurences of "1"/"0" (or"TRUE"/"FALSE") in a row w. conditions in the next BCB New Users to Excel 7 May 13th 06 10:02 PM


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