View Single Post
  #9   Report Post  
Posted to microsoft.public.excel.programming
Ivyleaf Ivyleaf is offline
external usenet poster
 
Posts: 141
Default search buttons please help

Hi Michael,

If I understand you correctly and the code is showing up in red
colour, it sounds like you are just having problems with the wrapping.
Try the following with the lines shortened:

Cells.Find(What:=SearchStr, After:=ActiveCell, _
LookIn:=xlFormulas, LookAt:=xlPart, _
SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False).Activate

Cheers,

On Apr 2, 6:42 pm, Michael wrote:
hello? How r you today ? How's everybody ? well unfortunatelly it doesn't
work. I created the blank office worksheet added my database, CommandButton,
Text box i made sure that i copied the code and paste i correct place. The
formula below doesnt work as it is red:
Cells.Find(What:=SearchStr, After:=ActiveCell, LookIn:=xlFormulas,
_
LookAt:=xlPart, SearchOrder:=xlByRows,
SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False).Activate
I dont know whats wrong ;( Im loosing my mind... My PC runs Office 2000
maybe that is why ? I assume that it doesnt matter because the code should
stay the same in upgrated version as well?! Im getting fed up of all those
codes

"Ivyleaf" pisze:



Hi Michael,


No, work is fine... thanks for asking :). As I said, I relly wasn't
trying to make a personal comment. I know it sounded like I was but I
was simply very puzzled and I really couldn't think of another way to
ask. I sincerely do apologise.


As for your question, the following code should give a starting point:


Private Sub CommandButton1_Click()
Dim SearchStr As String


SearchStr = TextBox1.Text


Cells.Find(What:=SearchStr, After:=ActiveCell, LookIn:=xlFormulas,
_
LookAt:=xlPart, SearchOrder:=xlByRows,
SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False).Activate


End Sub


This assumes you have added a form with a text box called TextBox1 and
a button called CommandButton1. If you want to use the returned range
somewhere, get rid of the ".Activate" at the end of the search bit,
and use a variable to catch the range: Set FoundRng = Cells.Find(...


Cheers,
Ivan.


On Apr 2, 12:34 am, Michael wrote:
so first of all u r not beeing rude its curiosity isnt it
second of all its database for people who dont know excel that well as i
think you do
third of all my Boss gave me that order
forth of all r u able to help me ? or should i wait for someone who knows
how to do it cuz i really need a help.
Meanwhile save ur personal comments for yourself :-) I had asked for help
not asked what i want to achieve- Are you having a bad day at work ? ;-)
Cheers,
Michael- Hide quoted text -


- Show quoted text -