View Single Post
  #1   Report Post  
aftamath
 
Posts: n/a
Default Picture during Double Click

I'm trying to get the code in VBA to insert and remove a picture from a cell
when double clicked. Is this possible and how do I get the picture to center
in the cell.

Please fix this code.

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As
Boolean)
Cancel = True

If Target.Column = 8 Then
If Trim(Target.Value) = "" Then
Target.Value = Pictures.Insert("A:\Check.gif")
Target.PicturePosition = fmPicturePositionCenter
ElseIf Target.Value = ActiveSheet.Pictures.Insert("A:\Check.gif") Then
Target.Value = ActiveSheet.Pictures.Delete("A:\Check.gif")
Else
MsgBox "Cannot toggle switch in " & Target.Address(0, 0)
End If
End If



End Sub