Hi,
Having a little bit of a problem with building a VBA module code that will detect if a certain picture is being used within a cell. Ive got to a point where the code will recognise if a picture is being displayed but cannot differentiate between the two picture references and so will always display TRUE.
I need the code to recognise that any picture with the picture reference of "YES_#####" (random numbers) is displayed as TRUE and anything else will return as a FALSE value.
Below is the code as it stands at the moment. I'm extremely new to VBA code so I am struggling massively here, and any help would be extremely appreciated.
Dim bResult As Boolean
bResultPic = False
If Not ActiveSheet.Shapes Is Nothing Then
For Each shp In ActiveSheet.Shapes
If shp.TopLeftCell.Address = Target.Address "*YES_" _
And shp.BottomRightCell.Address = Target.Address "*YES_" Then
bResultPic = True
End If
Next shp
End If
HasImage = bResultPic
End Function
Having a little bit of a problem with building a VBA module code that will detect if a certain picture is being used within a cell. Ive got to a point where the code will recognise if a picture is being displayed but cannot differentiate between the two picture references and so will always display TRUE.
I need the code to recognise that any picture with the picture reference of "YES_#####" (random numbers) is displayed as TRUE and anything else will return as a FALSE value.
Below is the code as it stands at the moment. I'm extremely new to VBA code so I am struggling massively here, and any help would be extremely appreciated.
Dim bResult As Boolean
bResultPic = False
If Not ActiveSheet.Shapes Is Nothing Then
For Each shp In ActiveSheet.Shapes
If shp.TopLeftCell.Address = Target.Address "*YES_" _
And shp.BottomRightCell.Address = Target.Address "*YES_" Then
bResultPic = True
End If
Next shp
End If
HasImage = bResultPic
End Function