LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 141
Default Ron de Bruins Delete Row Code Q

Just used one of Ron de Bruins pieces of code to delete rows if a certain
value is in Column C, I tailored it somewhat to what I want (quite chuffed
with myself!), however I would prefer if the values that I want deleted in
Column B looked at a named range (i..e I could expand with entries I want
deleted without any change required to the VB bit). I'm also looking for the
code to also delete all rows that have a value of " " i.e. blank in Column C
of Sheet Sales Mix

Thanks for the code Ron

Public Sub SelectiveDelete()
Application.ScreenUpdating = False

With Application
.Calculation = xlManual
.MaxChange = 0.001
End With

Dim Lrow As Long
Dim CalcMode As Long
Dim StartRow As Long
Dim EndRow As Long


Sheets("Sales Mix").Select
With ActiveSheet
.DisplayPageBreaks = False

StartRow = 2
EndRow = .Cells(.Rows.Count, "C").End(xlUp).Row
For Lrow = EndRow To StartRow Step -1
If IsError(.Cells(Lrow, "C").Value) Then
'Do nothing, This avoid a error if there is a error in the
cell

ElseIf .Cells(Lrow, "c").Value = "37" Then
..Rows(Lrow).EntireRow.Delete shift:=xlUp
'This will delete each row with the Value "ron" in Column A,
case sensitive.

End If
Next
End With


With Application
.Calculation = xlAutomatic
.MaxChange = 0.001
End With
ActiveWorkbook.PrecisionAsDisplayed = False
Application.ScreenUpdating = True

End Sub


 
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
Delete code chrisnsmith Excel Discussion (Misc queries) 4 March 8th 09 01:10 AM
code to delete rows ianalexh Excel Discussion (Misc queries) 5 May 5th 05 10:46 AM
Delete Shortcut with Code zSplash Excel Programming 9 April 10th 04 06:55 PM
VBA code delete code but ask for password and unlock VBA protection WashoeJeff Excel Programming 0 January 27th 04 07:07 AM
VBA code to delete VBA code in another Workbook Chip Pearson Excel Programming 0 September 15th 03 03:54 PM


All times are GMT +1. The time now is 11:13 AM.

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

About Us

"It's about Microsoft Excel"