![]() |
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 |
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 |
All times are GMT +1. The time now is 07:18 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com