Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 270
  • Last Modified:

Restrict a text box

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
marks97
Asked:
marks97
1 Solution
 
AKbor75Commented:
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
 
marks97Author Commented:
I have worked out a way of doing it. It is
TextBox1 = Round(TextBox1.Value, 2)
Thanks for your help though.
marks97
0
 
CleanupPingCommented:
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
 
RotaredoMCommented:
Question answered by questioner.

50 points refunded & question PAQed.

RotaredoM
CS Mod @ EE
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

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