Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Format text box with check box
Hi,
I have a text box (txtphone) into which a user enters a phone number. The default format of txtphone is "00-0000-0000". I also have a check box (chkmobile) which I want the user to tick if the phone number is a mobile number. When chkmobile is ticked I want the format of txtphone to change to "0000-000-000" and then if it is unticked change back to default "00-0000-0000". Make sense? Currently I have: Private Sub txtPhone_afterupdate() If chkMobile.Value = False Then txtPhone.Value = Format(Me.txtPhone.Value, "00-0000-0000") End If End Sub Private Sub chkmobile_click() If chkMobile.Value = True Then txtPhone.Value = Format(Me.txtPhone.Value, "0000-000-000") End If End Sub When I enter a number into txt phone currently and tab out the format changes to the default but ticking chkmobile does nothing. Any help is greatly appreciated. Rachel |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Format text box with check box
Sorry - duplicated question. Already answered, I just couldn't find the
original post. Thanks :) "Rachel" wrote: Hi, I have a text box (txtphone) into which a user enters a phone number. The default format of txtphone is "00-0000-0000". I also have a check box (chkmobile) which I want the user to tick if the phone number is a mobile number. When chkmobile is ticked I want the format of txtphone to change to "0000-000-000" and then if it is unticked change back to default "00-0000-0000". Make sense? Currently I have: Private Sub txtPhone_afterupdate() If chkMobile.Value = False Then txtPhone.Value = Format(Me.txtPhone.Value, "00-0000-0000") End If End Sub Private Sub chkmobile_click() If chkMobile.Value = True Then txtPhone.Value = Format(Me.txtPhone.Value, "0000-000-000") End If End Sub When I enter a number into txt phone currently and tab out the format changes to the default but ticking chkmobile does nothing. Any help is greatly appreciated. Rachel |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Check box to change the format of a text box | Excel Programming | |||
Need help with converting CUSTOM format/TEXT format to DATE format | Excel Worksheet Functions | |||
Check data item is date not text format | Excel Programming | |||
Check if Conditional Format is True or False / Check cell Color | Excel Worksheet Functions | |||
check variable(text) with cell (text), textbox | Excel Programming |