SEARCH MACRO problem!!

I

ICED_EARTH

HI!!

I tried to create a search macro by doing the following steps.

1) Clicked on an empty cell
2) Clicked on record macro
3) EDIT> FIND> typed the copied data from a different cell> FIND NEXT
CLOSE
4) stoped the record.
5) CLick on RUn ..

When I did that It shows me the value which I had entered.. what
would like to do is create a search button in my excel worsheet..... s
that I can type the data I want to find and then seach for the dat
from the worksheet...( eg. 4444).

Thx...
Regard
 
B

BrianB

When recording a macro you perform actions exactly as normal in Excel
so you can check you get the right result. You then press keys Alt +F1
to open the VB Editor and change the code to relate to more genera
circumstances. Here is the "Before and After" where I have changed
recorded macro to look in cell A1 for the search value :-

'----------------------------------------------------------
Sub Macro1() ' recorded macro
Cells.Find(What:="4444", After:=ActiveCell, LookIn:=xlFormulas
LookAt _
:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext
MatchCase:= _
False).Activate
End Sub
'-------------------------------------------------------------
Sub MyFindMacro()
MyValue = ActiveSheet.Range("A1").Value
Cells.Find(What:=MyValue).Activate
End Sub
'-------------------------------------------------------------
 
I

ICED_EARTH

HI!!

Thx for you help.. actually what I wanted to do was to create
text box with a search button so that when I enter the Name and age o
a person in the text box and click the "search button" I should be abl
to find that person..in my excel sheet...

Is it possible to do that?..

Can you help me out..?

P.S. I will be waiting for ur reply..

Thank YOu..

Regards,
MA
 
Top