mrgrumpball
New Member
- Joined
- Feb 27, 2020
- Messages
- 1
- Office Version
- 2019
- Platform
- Windows
Hi,
I have been regularly using the scatterplot in excel, with the well working macro to add labels to (https://support.microsoft.com/en-us...-labels-to-data-points-in-an-xy-scatter-chart) markers. Text is just sitting in the column left to the coordinates. This works perfectly for text.
I am now looking for an adaptation of the macro, where
An adaptation that was suggested but does not seems to work was based on userpicture (Scatter Plot Labeling with Images). This returns an error. Can anyone suggest the changes to makes
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
I have been regularly using the scatterplot in excel, with the well working macro to add labels to (https://support.microsoft.com/en-us...-labels-to-data-points-in-an-xy-scatter-chart) markers. Text is just sitting in the column left to the coordinates. This works perfectly for text.
I am now looking for an adaptation of the macro, where
- "images" would be inserted in the lable instead of the text,
- source of the images: a list of images in a specific location (local drive, or url). Generrally, there are about 70 to 100 images to insert.
- Format would be 80x50 pixels.
- Ideally the size of the label box would also be adapted in the so the image does not get distorted
An adaptation that was suggested but does not seems to work was based on userpicture (Scatter Plot Labeling with Images). This returns an error. Can anyone suggest the changes to makes
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