"Find" Macro

C

Charles

Scott,
I just tested this code and it worked for me.
I created a userform with textbox and a command button

I'm using excell 2000 with windows XP. but i knoe it works for window
98


Charle
 
S

scottnshelly

I'm on Excel 2000 on XP also. I made a commandbutton and put the cod
on it. i checked the userform to make sure that it had a textbox name
textbox1 and a commandbutton. and it still gives me the same error.
thank
 
C

Charles

Scott,

Sorry its not working for you. As to why I can't really say. Did yo
copy my code and it still failed??
Here's my code.

Private Sub CommandButton1_Click()
Sheets("sheet1").Activate
With UserForm1
On Error Resume Next
Cells.Find(What:=TextBox1.Text, lookat:=xlPart).Select
If Err = 91 Then
MsgBox "I'm Sorry could not find From Date: " &
TextBox1.Text
Else
Range(ActiveCell, ActiveCell.Offset(0, 4)).Copy
End If
End With
End Sub

Charle
 
S

scottnshelly

Thanks again Charles,
still no soup. i did find something interesting however. i still go
the same error, Compile Error: variable not defined.
i made a new workbook and put one button on it and slapped that code t
it, copied and pasted from your post, and put a userform on it and i
didn't give me that error. it didn't pop up my userform though. a
first it just copied the active cell and the three to the right of it.
then i put the button on sheet2 and it just took me to sheet 1.
nothing copied, nothing pasted.
am i supposed to put any kind of code on the button or text box in th
userform?
anything else i should know
Again i really appreciate you taking time out of your busy day to hel
some idiot with some computer stuff
 
C

Charles

Scott,

If possible could send me an e-mail address so I can send you what
have.
my address is (e-mail address removed)
I too created a command button on the worksheet. I double clicked i
and assigned the userform1.show code. When clicked it displays th
userform with a textbox and a commandbutton for input.

some times seeing is better.
and no one is an idiot for trying and learning

Charle
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top