View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Martin Fishlock Martin Fishlock is offline
external usenet poster
 
Posts: 694
Default Conditional Formatting

Hi Tazzy,

You could try a macro on the worksheet. I checks if the answer is not
correct, it is just a number is 24 for 8X3 or otherwise.

You need to consider how you want to check the formulas but you just need
to parse the szFormula string and consider whay you want to do.

'============start==========
Private Sub Worksheet_Change(ByVal Target As Range)
Dim lRow As Long
Dim lCol As Long
Dim lAns As Long
Dim rTable As Range
Dim szFormula As String
Application.EnableEvents = False
Set rTable = ActiveSheet.Range("B2:K11")
If Not Intersect(rTable, Target) Is Nothing Then
szFormula = Target.Formula
lRow = Target.Row
lCol = Target.Column
lAns = (lRow - 1) * (lCol - 1)
If Target.Value < lAns Then
Target.Interior.ColorIndex = 3 ' incorrect ans
ElseIf szFormula = Target.Value Then
Target.Interior.ColorIndex = 6 ' just a number
Else
Target.Interior.ColorIndex = 8 ' formula
End If
End If
Application.EnableEvents = True
End Sub
'============end===========
This macro should be placed in the code for the specific worksheet.

--
Hope this helps
Martin Fishlock
Please do not forget to rate this reply.


"Tazzy via OfficeKB.com" wrote:

Hi Driller,

Thanks for your answer, and I agree, I will need to verify the exact formula
they have put in. It is to be used as a homework exercise and I was going to
lock and protect the sheet, apart from the blank cells where they have to
enter the frmula. I was hoping that they would have to work at this, knowing
that when they got the formula exact, the cell would change colour, and so
they would then realise that they had got the formula correct. Any
suggestions?

--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...tions/200612/1