Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 12
Default formatting a cell for both ZIP and ZIP+4

I am using data validation to ensure the cells in the range are either 5 or 9
digits in length; however, I don't know how to set the formatting of the cell
to recognize whether to use the Zip Code format or the ZIP Code +4 format.

Can I get both?
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3,572
Default formatting a cell for both ZIP and ZIP+4

Post the formulas you're using to ensure a 5 or 9 digit entry.
--
Regards,

RD

---------------------------------------------------------------------------
Please keep all correspondence within the NewsGroup, so all may benefit !
---------------------------------------------------------------------------
"dandiehl" wrote in message
...
I am using data validation to ensure the cells in the range are either 5 or
9
digits in length; however, I don't know how to set the formatting of the
cell
to recognize whether to use the Zip Code format or the ZIP Code +4 format.

Can I get both?



  #3   Report Post  
Posted to microsoft.public.excel.misc
CLR CLR is offline
external usenet poster
 
Posts: 594
Default formatting a cell for both ZIP and ZIP+4

Maybe with something like this..........

Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range)
If Len(Target) = 5 Then
Selection.NumberFormat = "00000"
Else
If Len(Target) = 9 Then
Selection.NumberFormat = "00000-0000"
Else
End If
End If
End Sub

Vaya con Dios,
Chuck, CABGx3


"dandiehl" wrote in message
...
I am using data validation to ensure the cells in the range are either 5

or 9
digits in length; however, I don't know how to set the formatting of the

cell
to recognize whether to use the Zip Code format or the ZIP Code +4 format.

Can I get both?



  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default formatting a cell for both ZIP and ZIP+4

Try a custom format of
Format|Cells|Number tab|Custom category
[99999]00000-0000;00000

dandiehl wrote:

I am using data validation to ensure the cells in the range are either 5 or 9
digits in length; however, I don't know how to set the formatting of the cell
to recognize whether to use the Zip Code format or the ZIP Code +4 format.

Can I get both?


--

Dave Peterson
  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 12
Default formatting a cell for both ZIP and ZIP+4

Thank you all for your help!

"Dave Peterson" wrote:

Try a custom format of
Format|Cells|Number tab|Custom category
[99999]00000-0000;00000

dandiehl wrote:

I am using data validation to ensure the cells in the range are either 5 or 9
digits in length; however, I don't know how to set the formatting of the cell
to recognize whether to use the Zip Code format or the ZIP Code +4 format.

Can I get both?


--

Dave Peterson

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
Maintain cell formatting in target cell when using Paste bbotzler Excel Discussion (Misc queries) 1 February 27th 07 12:26 AM
conditional Formatting based on cell formatting Totom Excel Worksheet Functions 3 January 20th 07 02:02 PM
conditional Formatting based on cell formatting Totom Excel Worksheet Functions 0 January 15th 07 04:35 PM
expanding custom formatting without removing existing cell formatting? Keith Excel Worksheet Functions 3 December 27th 06 01:54 PM
Conditional cell background formatting, based on cell content nosivad Excel Discussion (Misc queries) 5 February 11th 06 11:12 PM


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