View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Die_Another_Day Die_Another_Day is offline
external usenet poster
 
Posts: 644
Default Can I build a Find function into my spreadsheet without a button?

right click the worksheet tab that your data is in. Select View Code,
Select "Worksheet" in the Left ComboBox and "Change" in the Right
ComboBox
This sub should appear:
Private Sub Worksheet_Change(ByVal Target As Range)

End Sub

Add this line of code followed by your code
If Target.Address < Range("A1").Address Then Exit Sub

HTH

Charles


nbaj2k wrote:
I was looking to see if its possible to build a find function into my
spreadsheet.

What I want it to do is if I type something in A1, I want it to only
show the rows include cells that have that in it. For example if I
typed in Basketball, I want it to search *Product* throughout the
worksheet and only show the rows that have that in it.

I was hoping to do it without a button, so i just click off of the cell
and it does the search. If I type back in the cell and click off of it
it does it again.

I was able to do it with a button and autofilters, making A1 equal the
criteria, but I wanted to know if it was possible just to type
something in and click off and it searches. The code below is what I
have now, but it only works if I assign that code to a button. If I
can get the code below to work without having to click a button and
just click off of the cell, that would be fine too.

Thanks,

~J

Dim Entry As String
Entry = "*" & Range("A1") & "*"
Range("A2").Select
Rows("3:3").Select
Selection.AutoFilter
Range("A3").Select
Selection.AutoFilter Field:=1, Criteria1:=Entry, Operator:=xlAnd


--
nbaj2k
------------------------------------------------------------------------
nbaj2k's Profile: http://www.excelforum.com/member.php...o&userid=36480
View this thread: http://www.excelforum.com/showthread...hreadid=574376