Hello all,
I am relatively new to VBA, and hope this is an easy question for you experts out there to address. I am currently using the code supplied at McGimpsey & Associates : Excel : Display picture based on cell value to display a picture based on a cell value. The code is shown below:
I am wondering what the best way (if possible) of having this code be applied to a range of cells, say F1:F4, would be? I tried simply changing the F1 in the code to the range F1:F4, but it did not seem to work. Any help is appreciated!
I am relatively new to VBA, and hope this is an easy question for you experts out there to address. I am currently using the code supplied at McGimpsey & Associates : Excel : Display picture based on cell value to display a picture based on a cell value. The code is shown below:
Code:
Private Sub Worksheet_Calculate()
Dim oPic As Picture Me.Pictures.Visible = False
With Range("F1")
For Each oPic In Me.Pictures
If oPic.Name = .Text Then
oPic.Visible = True
oPic.Top = .Top
oPic.Left = .Left
Exit For
End If
Next oPic
End With
End Sub
I am wondering what the best way (if possible) of having this code be applied to a range of cells, say F1:F4, would be? I tried simply changing the F1 in the code to the range F1:F4, but it did not seem to work. Any help is appreciated!
Last edited: