Private Sub DeleteRowsWithSmallAmountAtIssue() ' Delete rows that have a value of Delete in Column B. Dim rng1 As Range Dim rng2 As Range Dim lngRow As Long 'Application.ScreenUpdating = False If [b2] <> vbNullString Then Set rng1 = Range([b2], [b1].End(xlDown)) Else Set rng1 = [b1] End If For lngRow = rng1.Rows.Count To 2 Step -1 If (Cells(lngRow, "B") = "Delete") Then 'Rows(lngRow).EntireRow.Delete If rng2 Is Nothing Then Set rng2 = Rows(lngRow) Else Set rng2 = Union(rng2, Rows(lngRow)) End If Else ' If Left$(Cells(lngRow, "c"), 2) <> "CV" Then Rows(lngRow).EntireRow.Delete End If Next rng2.EntireRow.Delete Application.ScreenUpdating = True End Sub
|How to use odbc in vb to connect to ms sql||14||34|
|I need to access elements from an existing child window to extrat info!||19||43|
|Excel Score Formula||5||47|
|Highlighting cells in Excel||9||16|
Join the community of 500,000 technology professionals and ask your questions.
Connect with top rated Experts
17 Experts available now in Live!