Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I want to find a value in colum "B" and delete all row above except
the first row. I tried to adapt the code below without success. Option Explicit Sub delete_row_and_below() Dim rFound As Range Dim myRange As Range Dim myLastRow As Long Dim sName As String myLastRow = ActiveSheet.Cells(65000, 2).End(xlUp).Row Set myRange = ActiveSheet.Range("B1:B" & myLastRow) sName = "LI-HANDTMG" Set rFound = myRange.Find(What:=sName, _ LookIn:=xlValues, _ LookAt:=xlWhole, _ MatchCase:=False) If rFound Is Nothing Then MsgBox sName & " was not found in Range." Else Set myRange = ActiveSheet.Range("b" & rFound.Row _ & ":f" & myLastRow) myRange.EntireRow.Delete End If End Sub Thanks Little Penny |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Find & and delete everything following | Excel Worksheet Functions | |||
Find and Replace - delete the remainder of the text in the cell after my Find | Excel Programming | |||
find a value and delete that row | Excel Discussion (Misc queries) | |||
find and delete duplicate entries in two columns or find and prin. | Excel Programming | |||
find and delete text, find a 10-digit number and put it in a textbox | Excel Programming |