Home |
Search |
Today's Posts |
#8
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
It's a good reminder to always save your workbook before trying (or
experimenting against a copy of the worksheet). DKY wrote: Yep, that was it. Apparently there was a space after each unit code. This code works great!!! Option Explicit Public Sub COLUMN_UNIT_CODE() Dim myCell As Range Dim delRng As Range 'Application.ScreenUpdating = False For Each myCell In Selection.Cells Select Case UCase(Trim(myCell.Value)) Case Is = "2A", "7G", "D1", "D2", "D6", _ "F3", "H1", "H5", "M4", "M6", "G5" 'Do nothing, keep it Case Else If delRng Is Nothing Then Set delRng = myCell Else Set delRng = Union(myCell, delRng) End If End Select Next myCell If delRng Is Nothing Then 'nothing found, do nothing Else delRng.EntireRow.delete End If End Sub -- DKY ------------------------------------------------------------------------ DKY's Profile: http://www.excelforum.com/member.php...o&userid=14515 View this thread: http://www.excelforum.com/showthread...hreadid=399226 -- Dave Peterson |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
delete every nth row in selected range | Excel Discussion (Misc queries) | |||
Macro run if and cell in range is selected in VBA | Excel Programming | |||
Macro run if and cell in range is selected in VBA | Excel Programming | |||
TO TOM OR KEN: macro to calculate selected range | Excel Programming | |||
Need a macro to delete selected rows | Excel Programming |