Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 142
Default Unwanted characters in a TextBox

I have a TextBox where the user is supposed to enter a SSN and a macro that
will search through records on another spreadsheet in an effort to match the
SSN. Sometimes users enters dashes in the SSN and sometimes they don't.
However, all the SSN's in the records have the dashes in them.

If someone enters a SSN without using dashes (or enters the dashes in the
wrong place), how do I adjust the TextBox value so that it is also a
"###-##-####" value just like the ones in the spreadsheet? Just having it
formatted as a SSN won't work; it actually needs to be "###-##-####".

Thanks all.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8,520
Default Unwanted characters in a TextBox

Try

Dim strSSN as String
strSSN = "1234567-89"
'OR
'strSSN = TextBox1.Text
MsgBox Format(Replace(strSSN, "-", ""), "000-00-0000")

If this post helps click Yes
---------------
Jacob Skaria


"Luke" wrote:

I have a TextBox where the user is supposed to enter a SSN and a macro that
will search through records on another spreadsheet in an effort to match the
SSN. Sometimes users enters dashes in the SSN and sometimes they don't.
However, all the SSN's in the records have the dashes in them.

If someone enters a SSN without using dashes (or enters the dashes in the
wrong place), how do I adjust the TextBox value so that it is also a
"###-##-####" value just like the ones in the spreadsheet? Just having it
formatted as a SSN won't work; it actually needs to be "###-##-####".

Thanks all.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 142
Default Unwanted characters in a TextBox

Perfect. That did it. Gratuitous thanks.

"Jacob Skaria" wrote:

Try

Dim strSSN as String
strSSN = "1234567-89"
'OR
'strSSN = TextBox1.Text
MsgBox Format(Replace(strSSN, "-", ""), "000-00-0000")

If this post helps click Yes
---------------
Jacob Skaria


"Luke" wrote:

I have a TextBox where the user is supposed to enter a SSN and a macro that
will search through records on another spreadsheet in an effort to match the
SSN. Sometimes users enters dashes in the SSN and sometimes they don't.
However, all the SSN's in the records have the dashes in them.

If someone enters a SSN without using dashes (or enters the dashes in the
wrong place), how do I adjust the TextBox value so that it is also a
"###-##-####" value just like the ones in the spreadsheet? Just having it
formatted as a SSN won't work; it actually needs to be "###-##-####".

Thanks all.

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
Unwanted characters saving to fie Fan924 Excel Programming 2 December 1st 08 03:24 AM
Removing unwanted characters Richard Excel Discussion (Misc queries) 2 June 23rd 06 07:34 PM
Removing unwanted characters jermsalerms Excel Discussion (Misc queries) 15 January 19th 06 09:20 PM
Removing unwanted characters Scorpvin Excel Discussion (Misc queries) 8 December 5th 05 09:07 PM
UserForm TextBox to ActiveSheet TextBox over 256 characters Dan E[_2_] Excel Programming 1 July 28th 03 07:36 PM


All times are GMT +1. The time now is 03:55 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"