• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 167
  • Last Modified:

Excel 2003 VB Variable used in Controls of user froms.

Hello,

I am creating a user form in Excel that has a number of text boxes that a user enters data into. Some are to be numeric only.  If a user enters non-numeric data in the box there is code to catch that and return a zero value and lets the user know.  Rather than right the code for each box I assign a integer variable to the code on each TextBox and pass that along to a public function that uses that to create a variable representing the TextBox control name.  ie  It takes "TextBox" and combines it with 1, 2, 3, etc and uses that as the control name to run the routine.  It fails please help.  Sample is attached. Text-Box-Variable.xls
0
DavidH7470
Asked:
DavidH7470
1 Solution
 
StephenJRCommented:
Not sure what you are doing, but perhaps amend module1 to
 If Not IsNumeric(UserForm1.Controls(StrOptName).Value) Then

Open in new window

0
 
DavidH7470Author Commented:
Great Thank you.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now