I don’t do a lot of VBA. I have some code:
If Target.Address = "$H$1" Then
Range("A13").Comment.Shape.Fill.UserPicture Range("H2").Value
End If
Simple. Changes Comment BG image based on criteria in cell A13, plugs in a file/path generated by H2. However…
Sometimes the file/path doesn’t exist for what’s in H2 (as H2 is created based on user input/selection).
I’ve tried this:
If Target.Address = "$H$1" Then
Range("A13").Comment.Shape.Fill.UserPicture Range("H2").Value
Else
Range("A13").Comment.Shape.Fill.UserPicture Range("H6").Value
End If
Where H6 is another generated file/path to “NOIMAGE.jpg”, which would be a constant for any entry that doesn’t have an associated image. It doesn’t like that either.
I can’t find an else expression that will do what it needs before the method tried to run/find what’s in H2.
Ideas?
Try this