Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
MACRO which deletes a row, when it finds a specific number
Hi,
I want to create a macro which find one specific number in the column B and delete the row. For example: There is the number 60 in the cell B15 by accident. The macro will delete the row No 15. Thanks in advance, Spiros |
#2
Posted to microsoft.public.excel.misc
|
|||
|
|||
MACRO which deletes a row, when it finds a specific number
You could apply autofilter to column B, select 60 from the drop-down,
highlight the visible rows and Edit | Delete Row. Then select All from the drop-down. Hope this helps. Pete On Dec 3, 7:51 am, Spiros wrote: Hi, I want to create a macro which find one specific number in the column B and delete the row. For example: There is the number 60 in the cell B15 by accident. The macro will delete the row No 15. Thanks in advance, Spiros |
#3
Posted to microsoft.public.excel.misc
|
|||
|
|||
MACRO which deletes a row, when it finds a specific number
Record a macro using editfind. If you want more than one use findnext
-- Don Guillett Microsoft MVP Excel SalesAid Software "Spiros" wrote in message ... Hi, I want to create a macro which find one specific number in the column B and delete the row. For example: There is the number 60 in the cell B15 by accident. The macro will delete the row No 15. Thanks in advance, Spiros |
#4
Posted to microsoft.public.excel.misc
|
|||
|
|||
MACRO which deletes a row, when it finds a specific number
Guys thank you for your suggestions.
I find this macro end it works. Sub testme02() Dim myRng As Range Dim FoundCell As Range Dim wks As Worksheet Dim myStrings As Variant Dim iCtr As Long myStrings = Array("60") 'add more strings if you need Set wks = ActiveSheet With wks Set myRng = .Range("b2:b" & .Rows.Count) End With For iCtr = LBound(myStrings) To UBound(myStrings) Do With myRng Set FoundCell = .Cells.Find(what:=myStrings(iCtr), _ after:=.Cells(.Cells.Count), _ LookIn:=xlValues, _ lookat:=xlWhole, _ searchorder:=xlByRows, _ searchdirection:=xlNext, _ MatchCase:=False) If FoundCell Is Nothing Then Exit Do Else FoundCell.EntireRow.Delete End If End With Loop Next iCtr End Sub Ο χρήστης "Don Guillett" *γγραψε: Record a macro using editfind. If you want more than one use findnext -- Don Guillett Microsoft MVP Excel SalesAid Software "Spiros" wrote in message ... Hi, I want to create a macro which find one specific number in the column B and delete the row. For example: There is the number 60 in the cell B15 by accident. The macro will delete the row No 15. Thanks in advance, Spiros |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Create a macro that finds values then sorts | Excel Worksheet Functions | |||
Macro that deletes every third row....+ | Excel Discussion (Misc queries) | |||
What is a function in VBA EXCEL witch finds a string like "not" in cell and then deletes a row with this cell? | Excel Worksheet Functions | |||
macro that finds text and keeps only part of it | Excel Discussion (Misc queries) | |||
Which @function finds the mean of a number? | Excel Worksheet Functions |