Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
create a loop macro
how can i create a macro that look for a data in a cell, delete the row in
that cell, delete 7 rows down, and repeat the action until it find no more cells containing the data. Thanks so much for your help. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
create a loop macro
Sub DeleteData()
Dim rng As Range Dim target As String target = InputBox("Enter Search Term") If target = "" Then Exit Sub Do If Not rng Is Nothing Then rng.Resize(8, 1).EntireRow.Delete End If Set rng = Nothing Set rng = Cells.Find(What:=target, _ After:=ActiveCell, _ LookIn:=xlFormulas, _ LookAt:=xlPart, _ SearchOrder:=xlByRows, _ SearchDirection:=xlNext, _ MatchCase:=False) Loop While Not rng Is Nothing End Sub obviously test this on a copy of your workbook/data. -- Regards, Tom Ogilvy "andresg1975" wrote: how can i create a macro that look for a data in a cell, delete the row in that cell, delete 7 rows down, and repeat the action until it find no more cells containing the data. Thanks so much for your help. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Create a loop | Excel Discussion (Misc queries) | |||
create a loop | Excel Programming | |||
Is it possible to create variables in a loop.. | Excel Programming | |||
How do I create a For loop within a For loop? | Excel Programming | |||
Macro to move, create formulas and loop | Excel Programming |