Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Avoiding error on Input Box - if no value is entered dhstein Excel Discussion (Misc queries) 5 April 25th 09 12:43 PM
Help deleting equal credits and debit columns Neo Excel Discussion (Misc queries) 8 April 10th 08 12:42 AM
Deleting rows that are equal amts but different signs Dolphinv4 Excel Discussion (Misc queries) 1 December 28th 06 02:46 PM
Input Date when data is entered into another cell GaryByrd Excel Worksheet Functions 2 February 1st 05 12:37 AM
Question about Input Box and how to use the entered value TBA[_2_] Excel Programming 3 September 27th 03 03:46 PM


All times are GMT +1. The time now is 02:58 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"