Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 113
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 113
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Check box to change the format of a text box Rachel Excel Programming 5 December 3rd 09 12:33 PM
Need help with converting CUSTOM format/TEXT format to DATE format Deo Cleto Excel Worksheet Functions 6 June 2nd 09 08:14 PM
Check data item is date not text format Jimbob Excel Programming 3 August 4th 07 09:36 AM
Check if Conditional Format is True or False / Check cell Color Kevin McCartney Excel Worksheet Functions 5 June 29th 07 11:12 AM
check variable(text) with cell (text), textbox Mark[_17_] Excel Programming 1 August 27th 03 01:15 PM


All times are GMT +1. The time now is 09:05 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"