If you can double click on the cell (assumes that the picture doesn't cover the
whole cell):
Option Explicit
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As
Boolean)
Dim myPic As Picture
Dim PictName As String
Dim myRng As Range
PictName = "C:\Program Files\media\office10\Bullets\BD21301_.gif"
If Target.Cells.Count > 1 Then Exit Sub
If Intersect(Target, Me.Range("h:h")) Is Nothing Then Exit Sub
Application.EnableEvents = False
If Target.Value = "" Then
Target.Value = 1
ElseIf Target.Value = 1 Then
Target.Value = ""
End If
Application.EnableEvents = True
For Each myPic In Me.Pictures
Set myRng = Me.Range(myPic.TopLeftCell, myPic.BottomRightCell)
If Intersect(myRng, Target) Is Nothing Then
'do nothing
Else
myPic.Delete
End If
Next myPic
If Target.Value = 1 Then
Set myPic = Me.Pictures.Insert(PictName)
With Target
myPic.ShapeRange.LockAspectRatio = msoTrue
myPic.Height = .Height
myPic.Left = .Left + (Target.Width - myPic.Width) / 2
End With
End If
End Sub
There are other ways of putting a checkbox on a worksheet--you could use a
checkbox from the Forms toolbar or a checkbox from the control toolbox toolbar.
How about another option?
Format your column of cells in a nice way:
Format|cells|number tab|custom category
In the "type:" box, put this:
alt-0252;alt-0252;alt-0252;alt-0252
But hit and hold the alt key while you're typing the 0252 from the numeric
keypad.
It should look something like this when you're done.
ü;ü;ü;ü
(umlaut over the lower case u separated by semicolons)
And format that range of cells as Wingdings.
Now, no matter what you type (spacebar, x, anyoldtextatall), you'll see a check
mark.
Hit the delete key on the keyboard to clear the cell.
If you have to use that "checkmark" in later formulas:
=if(a1="","no checkmark","Yes checkmark")