Does it need to be a checkmark? How about highlighting the cell instead? Both could probably be down but the latter would be much easier! You wouldn't even need a macro.
You can use conditional formatting to change the background color if the cell value is 8. Highlight the cells that you want to format, click on Format, Conditional Format. Select "Cell Value Is" and "Equal to" and type in 8. Then change the format to however you want to format the cell. Let me know if you need clarification or more help.
Try this
Private Sub Worksheet_Change(ByVal Target As Range)
userinput = Target.Value
If userinput = 8 Then
newinput = "Check Mark"
Application.EnableEvents = False
Target = newinput
Application.EnableEvents = True
End If
End Sub
This will put the word check mark whenever you type 8. I dont know how to add an actual checkmark, but you can put any text or keyboard symbols.
Hope this gets you started.
Jacob
Liliani - I've copied symbols from Word into Excel. Try pasting an appropriate symbol into an unused, out-of-the-way cell. Using Jacob's approach, when your macro launches to ferret out the number eight, have the macro copy the symbol's cell's formula. eg,
chequemark = Range("AG9000").formula 'presuming you've hidden the symbol in that cell
and then make the "8" cell's formula equal to checkmark.
eg, Target.Formula = chequemark
That may work.
Tom
Uppercase "P", font-formatted to Wingdings2 should give you the checkmark symbol - hopefully you can slot this into the helpful codes above
Hi
I just worked out the complete code:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim UserInput
Dim CurrentRange
Dim FinalRange
Application.ScreenUpdating = False
UserInput = Target.Value
CurrentRange = Target.AddressLocal
FinalRange = ActiveCell.AddressLocal
On Error GoTo z:
If UserInput = 8 Then
Target = "P"
Application.EnableEvents = False
Range(CurrentRange).Select
With Selection.Font
.Name = "Wingdings 2"
.Size = 10
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic
End With
Range(FinalRange).Select
Application.EnableEvents = True
z:
End If
Application.EnableEvents = True
End Sub
Hope this is what you want
Jacob
Wow. Good Work. Now that that's been thrashed out, it's probably simpler for Liliana to change the cell font format to Wingdings 2, and type in "P" instead of an "8".
Well she wanted it to be automatic and thats what my code does. It will also work if a formula results in 8 value of 8.
Jacob