Hello all, first time posting here so I hope I'm doing this right...not a beginner with VBA but for some reason I am having a mental block here and can't figure this out for some reason. I found this bit posted by BiocideJ in 2014 in response to a question about needing an image of cells to pop up when double clicked like a tooltip of sorts. This code is awesome however it works all over the worksheet, I need it to work on a specific range, let's say A1. I have tried replacing the activesheet with a range and I've tried naming a range and calling it and it does not work...I hoping someone here can assist. TIA!
VBA Code:
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
Dim ImgRange As Range
'remove any picture images previously generated
For Each Shape In ActiveSheet.Shapes
If Left(Shape.Name, 7) = "Picture" Then
Shape.Delete
End If
Next
'pseudo-refresh window so partial image residuals don't show on screen
Application.WindowState = Application.WindowState
'You will need to set this range dynamically based on
[B] Set ImgRange = Range("J5:L13")[/B]
'shows the Range as it would display for printing.
'Change xlPrinter to xlScreen to show as it appears on the screen
ImgRange.CopyPicture xlPrinter, xlPicture
ActiveSheet.Paste Destination:=Target.Offset(0, 1)
With ActiveSheet.Shapes.Range(1)
.Line.Visible = msoTrue
.Line.ForeColor.RGB = RGB(100, 100, 100)
.Line.Transparency = 0
.Fill.Visible = msoTrue
.Fill.ForeColor.RGB = RGB(255, 255, 255)
.Fill.Transparency = 0
.Fill.Solid
End With
End Sub