Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
deleting rows that are not equal to a value entered from an input box, Please Help Me
Hi
I'm trying to make an excel document that, when you open it, it pops up an Input box. It will ask you for a number. Then once you hit enter it will search the first sheet in the first column and if the value is different then the one that you put in the input box it will delete the entire row. Thank you so much Laura |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
deleting rows that are not equal to a value entered from an input box, Please Help Me
Try this one Laura
A1 must have a header Sub Delete_with_Autofilter() Dim FindString As String Dim rng As Range FindString = InputBox("Enter your Findstring") If Trim(FindString) < "" Then With ActiveSheet .Columns("A").AutoFilter Field:=1, Criteria1:="<" & FindString With ActiveSheet.AutoFilter.Range On Error Resume Next Set rng = .Offset(1, 0).Resize(.Rows.Count - 1, 1) _ .SpecialCells(xlCellTypeVisible) On Error GoTo 0 If Not rng Is Nothing Then rng.EntireRow.Delete End With .AutoFilterMode = False End With End If End Sub -- Regards Ron de Bruin http://www.rondebruin.nl "Laura" wrote in message om... Hi I'm trying to make an excel document that, when you open it, it pops up an Input box. It will ask you for a number. Then once you hit enter it will search the first sheet in the first column and if the value is different then the one that you put in the input box it will delete the entire row. Thank you so much Laura |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Avoiding error on Input Box - if no value is entered | Excel Discussion (Misc queries) | |||
Help deleting equal credits and debit columns | Excel Discussion (Misc queries) | |||
Deleting rows that are equal amts but different signs | Excel Discussion (Misc queries) | |||
Input Date when data is entered into another cell | Excel Worksheet Functions | |||
Question about Input Box and how to use the entered value | Excel Programming |