Scatter Plot Labeling with Images

I found this bit of information on how to label a scatter plot here:  https://support.microsoft.com/en-us/help/213750/how-to-use-a-macro-to-add-labels-to-data-points-in-an-xy-scatter-chart-or-in-a-bubble-chart-in-excel

This is fantastic but does anyone know how to do exactly this, but instead of text labels have images as labels?

Thanks

-Mike Nelson

***Post moved by the moderator to the appropriate forum category.***

Let's say that the path and filename for your images are located in the corresponding cells one column to the right of the series values, replace...

   For Counter = 1 To Range(xVals).Cells.Count
     ActiveChart.SeriesCollection(1).Points(Counter).HasDataLabel = _
         True
      ActiveChart.SeriesCollection(1).Points(Counter).DataLabel.Text = _
         Range(xVals).Cells(Counter, 1).Offset(0, -1).Value
   Next Counter

with

    For Counter = 1 To Range(xVals).Cells.Count
        With ActiveChart.SeriesCollection(1).Points(Counter)
            .HasDataLabel = True
            With .DataLabel.Format.Fill
                .UserPicture Range(xVals).Cells(Counter, 1).Offset(0, 1).Value
                .Visible = msoTrue
            End With
        End With
    Next Counter

Hope this helps!

Was this reply helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this reply?

Thanks for your feedback.

 
 

Question Info


Last updated October 5, 2021 Views 184 Applies to: