Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Create a macro to find value then delete it
I am trying to create a macro that when the user clicks a button on userform1
it will find a value in sheet1 row b based on the textbox value on userform1, when it finds the value I want it to delete then entire row. I have tried but I cannot figure out how to make it do it |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Create a macro to find value then delete it
In the OnClick event of your button, do something like this (modify to
suite): Dim fRow As Long On Error GoTo ender fRow = Columns(2).Find(What:=txt1.Value, _ After:=Cells(1, 2), LookIn:=xlFormulas, _ LookAt:=xlWhole, SearchOrder:=xlByRows, _ SearchDirection:=xlNext, MatchCase:=False, _ SearchFormat:=False).Row Rows(fRow).Delete Exit Sub ender: MsgBox "Value not found" Mekinnik wrote: I am trying to create a macro that when the user clicks a button on userform1 it will find a value in sheet1 row b based on the textbox value on userform1, when it finds the value I want it to delete then entire row. I have tried but I cannot figure out how to make it do it |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
create a macro that looks for data and delete row | Excel Programming | |||
How to create a macro to delete multiple rows? | Excel Discussion (Misc queries) | |||
Create a macro to delete rows if value is less than a specified nu | Excel Worksheet Functions | |||
create macro - if cell is 0 delete row | Excel Worksheet Functions | |||
have Macro automatically delete and create sheets | Excel Programming |