I'm trying to fill a stacked excel-diagram with images based on a cell value. I can do it for the first column, but not for the second.
Here's an example. I want to fill the orange area with an images based on the values in column B
And here's the VBA-code how i fill the first column with an image:
Sub fill_with_image()
With Sheets("Sheet1").ChartObjects(1).Chart.SeriesCollection(1)
Set vAddress = ActiveSheet.Range(Split(Split(.Formula, ",")(1), "!")(1))
For i = 1 To vAddress.Cells.Count
imagefile = Cells(i + 1, 1).Value
.Points(i).Format.Fill.UserPicture (imagefile & ".png")
Next i
End With
End Sub
The second part of my question: I can't find any documentation how to fill treemap-diagrams with images. Any idea if its possible?
Just loop to select SeriesCollection(2)
Sub fill_with_image()
Dim j as integer
For j = 1 to 2
With Sheets("Sheet1").ChartObjects(1).Chart.SeriesCollection(j)
Set vAddress = ActiveSheet.Range(Split(Split(.Formula, ",")(1), "!")(1))
For i = 1 To vAddress.Cells.Count
imagefile = Cells(i + 1, 1).Value
.Points(i).Format.Fill.UserPicture (imagefile & ".png")
Next i
End With
Next j
End Sub