Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi VBA Professionals.
Please see my code. I am trying to only delete rows in an excel sheet where the value is equal to each string value provided below. However when I run this macro it deletes everything. I don't know what I am doing wrong. I won't lie. I am no programmer. Will you please help me with this? Thanks, Misty Sub Macro1() ' Keyboard Shortcut: Ctrl+d 'Sub DelEmptyRow() Rng = Selection.Rows.Count ActiveCell.Offset(0, 0).Select Application.ScreenUpdating = False For i = 1 To Rng If ActiveCell.Value = "Outpatient Chronic" Then Selection.EntireRow.Delete Else ActiveCell.Offset(1, 0).Select End If If ActiveCell.Value = "Dialysis Treatments" Then Selection.EntireRow.Delete Else ActiveCell.Offset(1, 0).Select End If If ActiveCell.Value = "Medications" Then Selection.EntireRow.Delete Else ActiveCell.Offset(1, 0).Select End If If ActiveCell.Value = "Ferrlecit*" Then Selection.EntireRow.Delete Else ActiveCell.Offset(1, 0).Select End If If ActiveCell.Value = "Zemplar*" Then Selection.EntireRow.Delete Else ActiveCell.Offset(1, 0).Select End If If ActiveCell.Value = "Cathflo*" Then Selection.EntireRow.Delete Else ActiveCell.Offset(1, 0).Select End If If ActiveCell.Value = "Clarity" Then Selection.EntireRow.Delete Else ActiveCell.Offset(1, 0).Select End If Next i Application.ScreenUpdating = True End Sub -- Message posted via OfficeKB.com http://www.officekb.com/Uwe/Forums.a...mming/200710/1 |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Code for deleting rows? | Excel Programming | |||
Deleting rows not containing one of 3 values | Excel Programming | |||
Deleting Rows with Same Values | Excel Programming | |||
VBA code for Deleting rows by verification | Excel Programming | |||
Code deleting values -- not as intended | Excel Programming |