find and delete row from certain value

SimpleSimon88

New Member
Joined
Jan 15, 2014
Messages
19
Hi, I'm struggling to find how to find a value in a range and delete that row.

Example:
search("textbox1.value"),sheets("sheet1").Range("A1:A5000").delete

Any ideas?

Si
 

Excel Facts

How to create a cell-sized chart?
Tiny charts, called Sparklines, were added to Excel 2010. Look for Sparklines on the Insert tab.
Hi Si,

What type of text box you are using here ?
form control or activex ?


Regards,
DILIPandey
 
Upvote 0
Anyways, give below code a try:-

Range("a1:a5000").Replace What:=Sheets("Sheet1").TextBox1.Text, Replacement:=""

Regards,
DILIPandey
 
Upvote 0
Hi fella!
Its a userform textbox and (preferably) would like to delete entire row.
I've found a basic loop but not really confident with loops yet.
It's userform1.textbox1.value

Si
 
Upvote 0
Dear Si,

You can use below code:-

Code:
Sub DILIPandey()
'checking and deleting rows based on a textbox's value
    For Each cell In Range("a1:a500")
        cell.Select
        If cell.Value = Sheets("Sheet1").TextBox1.Text Then
            ActiveCell.EntireRow.Delete
        End If
    Next
End Sub

where you can replace Sheets("Sheet1").TextBox1.Text with your userform's value


Regards,
DILIPandey
 
Upvote 0

Forum statistics

Threads
1,214,985
Messages
6,122,602
Members
449,089
Latest member
Motoracer88

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top