424 error

J

jr

I'm doing VBA in Excel 2004 on a form. This code gives me a 424
undefined object. I guess that means it wants me to define the
textbox control?


Private Sub CommandButton1_Click()
Dim players As Variant
players = Array("Dan", "Fred", "Bart", "Carlos", "Ty", "Juan", "Jay",
"Sam", "Pedro")
Dim i As Integer
i = CInt(texbox1.Text)
MsgBox (players(i) & " is on first base")
End Sub

thanks,
 
J

JE McGimpsey

jr said:
I'm doing VBA in Excel 2004 on a form. This code gives me a 424
undefined object. I guess that means it wants me to define the
textbox control?


Private Sub CommandButton1_Click()
Dim players As Variant
players = Array("Dan", "Fred", "Bart", "Carlos", "Ty", "Juan", "Jay",
"Sam", "Pedro")
Dim i As Integer
i = CInt(texbox1.Text)
MsgBox (players(i) & " is on first base")
End Sub

Do you have a textbox control on your userform named "texbox1" (i.e.,
not "textbox1")?
 
J

jr

Do you have a textbox control on your userform named "texbox1" (i.e.,
not "textbox1")?

Yeep. I changed it to textbox1 and it works better except now I get a
type 13 mismatch?
thanks,
 
J

JE McGimpsey

jr said:
Yeep. I changed it to textbox1 and it works better except now I get a
type 13 mismatch?

That would indicate that the Text in textbox1 can't be interpreted as
numeric.
 
J

JE McGimpsey

That would indicate that the Text in textbox1 can't be interpreted as
numeric.

I guess I better get VB.net instead of Excel 2004.[/QUOTE]

That seems rather a non-sequitur. What is the text in your textbox?
 

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