Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default Advanced Formatting

Does anybody know how to apply a special formatting to a cell in a way
that if "1" was typed in it it will display "1 Child" but if 2 or 3 or
4 was typed it shows "2 Childs" or "3 Childs" ....

Thank you

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,327
Default Advanced Formatting

Hi

No can do with formatting. Macro work. Rightclick the sheet tab, choose
"view code", paste the following into the blank moule:

Private Sub Worksheet_Change(ByVal Target As Range)
Dim L As Long
With Target(1)
L = Val(.Value)
Application.EnableEvents = False
Select Case L
Case 0
.Value = "No kids"
Case 1
.Value = L & " Child"
Case Else
.Value = L & " Childs"
End Select
Application.EnableEvents = True
End With
End Sub

HTH. Best wishes Harald

skrev i melding
oups.com...
Does anybody know how to apply a special formatting to a cell in a way
that if "1" was typed in it it will display "1 Child" but if 2 or 3 or
4 was typed it shows "2 Childs" or "3 Childs" ....

Thank you



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Advanced Formatting

Try a format of

[1]0" Childs";[0]0" Child";General

--
HTH

Bob Phillips

wrote in message
oups.com...
Does anybody know how to apply a special formatting to a cell in a way
that if "1" was typed in it it will display "1 Child" but if 2 or 3 or
4 was typed it shows "2 Childs" or "3 Childs" ....

Thank you



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,327
Default Advanced Formatting

Wohoo. I stand corrected. Thanks Bob.

Best wishes Harald

"Bob Phillips" skrev i melding
...
Try a format of

[1]0" Childs";[0]0" Child";General



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 230
Default Advanced Formatting

May I suggest an alternative:

[<1]0" Children";[=0]0" Child";General

to follow correct grammar:

0 children
1 child
2 or more children


"Harald Staff" wrote in message
...
Wohoo. I stand corrected. Thanks Bob.

Best wishes Harald

"Bob Phillips" skrev i melding
...
Try a format of

[1]0" Childs";[0]0" Child";General







  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Advanced Formatting

LOL. Guilty ... just answered the question.

Bob

"William Benson" wrote in message
...
May I suggest an alternative:

[<1]0" Children";[=0]0" Child";General

to follow correct grammar:

0 children
1 child
2 or more children


"Harald Staff" wrote in message
...
Wohoo. I stand corrected. Thanks Bob.

Best wishes Harald

"Bob Phillips" skrev i melding
...
Try a format of

[1]0" Childs";[0]0" Child";General







  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Advanced Formatting

I cheat...

# Child(ren)

(but you may want to use Children instead of Childs when you use Bob's
suggestion.)

wrote:

Does anybody know how to apply a special formatting to a cell in a way
that if "1" was typed in it it will display "1 Child" but if 2 or 3 or
4 was typed it shows "2 Childs" or "3 Childs" ....

Thank you


--

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
Advanced Conditional Formatting [email protected] Excel Worksheet Functions 8 September 22nd 08 01:33 PM
Advanced conditional formatting oli_qld Excel Discussion (Misc queries) 3 November 3rd 07 09:38 PM
Advanced Conditional Formatting Ideas Needed! (ok, maybe not that advanced...) shadestreet Excel Discussion (Misc queries) 2 July 21st 06 03:04 PM
Advanced Conditonal Formatting simsjr Excel Programming 1 August 21st 04 12:50 AM
Advanced Conditional Formatting Danny[_4_] Excel Programming 3 November 25th 03 05:18 PM


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

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

About Us

"It's about Microsoft Excel"