PC Review


Reply
Thread Tools Rate Thread

Create a macro to find value then delete it

 
 
=?Utf-8?B?TWVraW5uaWs=?=
Guest
Posts: n/a
 
      10th Oct 2007
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 With Quote
 
 
 
 
JW
Guest
Posts: n/a
 
      10th Oct 2007
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 With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
create a macro that looks for data and delete row =?Utf-8?B?YW5kcmVzZzE5NzU=?= Microsoft Excel Programming 11 22nd Feb 2008 02:20 PM
Create a macro to delete rows if value is less than a specified nu =?Utf-8?B?UUU=?= Microsoft Excel Worksheet Functions 5 27th Jul 2006 08:35 PM
create macro - if cell is 0 delete row =?Utf-8?B?cHl3aGFja2V0?= Microsoft Excel Worksheet Functions 1 15th Mar 2006 03:55 PM
Macro to find row and delete it Piet Lauwen Microsoft Excel Programming 1 18th Jan 2004 07:49 PM
Find and delete macro =?Utf-8?B?R0EgSG9ja2V5IE1vbQ==?= Microsoft Excel Worksheet Functions 6 29th Nov 2003 04:06 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 09:29 AM.