I have the following function that will display a picture if you run your mouse over it. It's quite neat and works well. However, I'd like to change it from running your mouse over it to a double click function.
Below is the code that works that will show a picture when you run a mouse over a cell:
Dim DoOnce As Boolean
Public Function OnMouseOver(URL As String, TheCell As Range)
DoOnce = True
With ActiveSheet.Pictures.Insert(URL)
With .ShapeRange
.LockAspectRatio = msoTrue
.Width = 570
.Height = 380
End With
.Left = Cells(TheCell.Row, TheCell.Column + 1).Left
.Top = Cells(TheCell.Row, TheCell.Column + 1).Top
.Placement = 1
.PrintObject = True
End With
End Function
And I know I need the below code, of sorts, that if you double click on it something will happen:
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
If Target.Address = "$A$1" Then
'do something
End If
Cancel = True
End Sub
I just can't seem to merge the two - so that I get the functionality of the original code, but with needing a double click rather than just passing the mouse over the cell.
The initial code references a concatenated picture lookup address in for pictures on my computer in sequential order for a process. I copy new links with the formula as more pictures are generated, which is quick, simple, and easy, and is why I want to keep the "OnMouseOver" function of the initial code, so I can copy this easily to new cells. I just want to action to reveal the pictures to be a double click, and not running the mouse over the cells as it currently works.
It would be a big help if I could get a hand with this.
Thanks,
Steve