Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Delete code | Excel Discussion (Misc queries) | |||
code to delete rows | Excel Discussion (Misc queries) | |||
Delete Shortcut with Code | Excel Programming | |||
VBA code delete code but ask for password and unlock VBA protection | Excel Programming | |||
VBA code to delete VBA code in another Workbook | Excel Programming |