Solved

Excel 2003 VB Variable used in Controls of user froms.

Posted on 2011-09-22
2
161 Views
Last Modified: 2012-05-12
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
Comment
Question by:DavidH7470
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 24

Accepted Solution

by:
StephenJR earned 500 total points
ID: 36583049
Not sure what you are doing, but perhaps amend module1 to
 If Not IsNumeric(UserForm1.Controls(StrOptName).Value) Then

Open in new window

0
 

Author Closing Comment

by:DavidH7470
ID: 36583099
Great Thank you.
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When you see single cell contains number and text, and you have to get any date out of it seems like cracking our heads.
How to get Spreadsheet Compare 2016 working with the 64 bit version of Office 2016
Graphs within dashboards are meant to be dynamic, representing data from a period of time that will change each time the dashboard is updated with new data. Rather than update each graph to point to a different set within a static set of data, t…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

628 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question