Microsoft Office Tutorials and References
In Depth Information
FORMAT A USER FORM TEXT BOX AS CURRENCY OR A PERCENTAGE
When someone right-clicks the form, the menu is displayed (Figure 146).
Figure 146. h
e custom right-click menu is displayed.
Summary: You can add right-click menu functionality to a user form.
Source: http://www.mrexcel.com/forum/showthread.php?t=97871
This topic was nominated by Microsoft MVP Greg Truby.
FORMAT A USER FORM TEXT BOX AS
CURRENCY OR A PERCENTAGE
Challenge: You are building a custom user form to calculate a monthly payment,
based on loan amount, number of payments, and interest rate. You would like one
text box on the form to be formatted as currency and another to be formatted as
a percentage. There do not appear to be a properties to format the text boxes.
Solution: You can use the BeforeUpdate code to grab what the person
types into a text box and format it properly. If someone types 20 , you can have
it automatically change to 20% when the user tabs out of the fi eld.
In the VBA editor, right-click your text box and choose View Code. Excel takes
you to the code pane and inserts a new procedure called TextBoxName.
Change . This is a good guess on Excel’s part, but you are going to use a
different event. From the right dropdown at the top of the dialog, choose
BeforeUpdate . Excel enters the start of the macro, and you need to fi ll in the
remaining lines.
To format a value as currency with two decimal places, use:
 
 
Search JabSto ::




Custom Search