#1   Report Post  
Posted to microsoft.public.excel.misc
Frederik12
 
Posts: n/a
Default Prevent Hard Inputs


How can I programs cells such that in case a hard input is used in a
formula the cell turns red (using conditional formatting).

Hard input in a formula is:
"+" and any digit
"-" and any digit
"*" and any digit
"/" and any digit

Regards,

Frederik


--
Frederik12
------------------------------------------------------------------------
Frederik12's Profile: http://www.excelforum.com/member.php...o&userid=32229
View this thread: http://www.excelforum.com/showthread...hreadid=519791

  #2   Report Post  
Posted to microsoft.public.excel.misc
Bob Umlas
 
Posts: n/a
Default Prevent Hard Inputs

You can define a function to return true if it contains one of those
characters, then use conditional formatting in that range to turn cells red
and reference the function, like
=SpecChar(A1) where A1 is the active cell when you use the conditional
formatting, and SpecChar is defined as:
Public Function SpecChar(rg) As Boolean
For Each thing In rg
If InStr(thing.Formula, "+") 0 Or _
InStr(thing.Formula, "-") 0 Or _
InStr(thing.Formula, "/") 0 Or _
InStr(thing.Formula, "*") 0 Then
SpecChar = True
Exit Function
End If
Next
End Function


"Frederik12" wrote
in message ...

How can I programs cells such that in case a hard input is used in a
formula the cell turns red (using conditional formatting).

Hard input in a formula is:
"+" and any digit
"-" and any digit
"*" and any digit
"/" and any digit

Regards,

Frederik


--
Frederik12
------------------------------------------------------------------------
Frederik12's Profile:

http://www.excelforum.com/member.php...o&userid=32229
View this thread: http://www.excelforum.com/showthread...hreadid=519791



  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1
Default Prevent Hard Inputs


Bob Umlas Wrote:
You can define a function to return true if it contains one of those
characters, then use conditional formatting in that range to turn cells
red
and reference the function, like
=SpecChar(A1) where A1 is the active cell when you use the conditional
formatting, and SpecChar is defined as:
Public Function SpecChar(rg) As Boolean
For Each thing In rg
If InStr(thing.Formula, "+") 0 Or _
InStr(thing.Formula, "-") 0 Or _
InStr(thing.Formula, "/") 0 Or _
InStr(thing.Formula, "*") 0 Then
SpecChar = True
Exit Function
End If
Next
End Function



Bob,

thanks, but how do I define a function?

KR


--
Frederik12
------------------------------------------------------------------------
Frederik12's Profile: http://www.excelforum.com/member.php...o&userid=32229
View this thread: http://www.excelforum.com/showthread...hreadid=519791

  #4   Report Post  
Posted to microsoft.public.excel.misc
vezerid
 
Posts: n/a
Default Prevent Hard Inputs

Alternatively, you can use the following formula in CF (with the
FormulaIs option)

=AND(OR(LEFT(A1,1)={"+","-","*","/"}),LEN(A1)=2,ISNUMBER(VALUE(MID(A1,2,1))))

HTH
Kostis Vezerides

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
Hard returns in a formula? PCLIVE Excel Worksheet Functions 5 February 8th 06 05:17 PM
How to put hard returns in a cell without going to the next cell Sera Excel Discussion (Misc queries) 1 November 16th 05 11:44 PM
how to remove hard returns, which show as little boxes eames.librarian Excel Discussion (Misc queries) 3 August 4th 05 07:46 PM
Automatic backup in excel with copy to hard drive and to cd-rw Tammies PITA Excel Discussion (Misc queries) 2 March 28th 05 04:08 PM
re Macro - too hard for me !! Anthony Excel Discussion (Misc queries) 3 February 28th 05 05:11 AM


All times are GMT +1. The time now is 06:40 AM.

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"