View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
JNW JNW is offline
external usenet poster
 
Posts: 480
Default InputMask for Textbox in UserForm

I understand...

If change doesn't work you may want to try the Exit event also.

"Henry T" wrote:

Thanks JNW, but I am really trying to find another way other than what you
suggested. So far, the solution is to manipulate the value with AfterUpdate
event. Wondering if it will work with Change event.

"JNW" wrote:

I don't know if there are input masks for excel. One workaround that works
for me with phone numbers and dates:

for phone numbers:
create 3 text boxes.
Set AutoTab to true for all three
Set max length to 3 for the first two boxes and 4 for the last
wherever the output for the form is place a concatenate in the code that
will place the formatted phone number in the cell.

Not the most streamline way of doing things, but it works.
(the same will work for date, just change the max lengths)


"Henry T" wrote:

Hi all,

I have textboxes that are used to get phones, dates, and currencies from the
user. How can I get the textboxes to have relevant input masks so that:

- instead of 2145559999, it'll be 214-555-9999 in the textboxes or (214)
555-9999
- instead of 091305, it'll be 09/13/05
- instead of 1234567.89, it'll be 1,234,567.89
????

Henry T

Of course the dashes or slashes or commas will be automatically added in the
textboxes as the users type along, instead of having the users type in the
formatting themselves.

Please help. Thanks.