?
Solved

Restrict a text box

Posted on 2003-03-31
4
Medium Priority
?
266 Views
Last Modified: 2010-05-03
How do you restrict a textbox in Excel VBA to only 2 decimal places. I have restricted the cell on the sheet that it pulls the data from but in the textbox it displays it in full. Any help will be greatly appreciated.
Thanks
Marks97
0
Comment
Question by:marks97
[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
4 Comments
 
LVL 2

Expert Comment

by:AKbor75
ID: 8237356
default, there's no restriction on a textbox. so you'll have to program that. you can use the keypress event.

concerning the cell: the value is often different from what you see. what you see (cell(x,y).text) may be 1.23 but the real value (cell(x,y).value) may be 1.23456789.
0
 

Author Comment

by:marks97
ID: 8237419
I have worked out a way of doing it. It is
TextBox1 = Round(TextBox1.Value, 2)
Thanks for your help though.
marks97
0
 

Expert Comment

by:CleanupPing
ID: 8531275
Hi marks97,
This old question (QID 20568534) needs to be finalized -- accept an answer, split points, or get a refund.  Please see http://www.cityofangels.com/Experts/Closing.htm for information and options.
0
 

Accepted Solution

by:
RotaredoM earned 0 total points
ID: 8536158
Question answered by questioner.

50 points refunded & question PAQed.

RotaredoM
CS Mod @ EE
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

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

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses
Course of the Month10 days, 2 hours left to enroll

762 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