Excel: How to position image dynamically in Excel?

1

Is there a way to display an image always at the bottom of the Pivot Table in Excel? Basically I am wondering if there is a way to create an image 'footer' for a pivot table.

Alex N.

Posted 2013-01-13T23:17:35.050

Reputation: 355

Answers

1

You can combine textboxes, inserting images and formatting as you like. Make sure it is a width and height that should match your pivot table. It can also be JUST an image. My example uses two images.

If you ever alter the grouped textbox size or anything about it, the name of it changes, so Determine the current grouped textbox name and change it to something consistent

enter image description here <<< >>>enter image description here

Sub rename_afoot()
    ActiveSheet.Shapes("Group 78").Name = "afoot"
End Sub

So now there is a known name for the textbox

enter image description here

My sample pivot table has the datasource as a defined name in the workbook. Any changes that expand the data change the size of the pivot table range.

Sub addfooter()
Dim LastRow
ActiveSheet.PivotTables("PivotTable1").RefreshTable
    LastRow = Sheet1.Range("h" & Rows.Count).End(xlUp).Row
ActiveSheet.Shapes("afoot").Select
    Selection.Cut
Range("H" & LastRow + 1).Select
    ActiveSheet.Paste
Range("H" & LastRow + 1).Select
End Sub

enter image description here

This moves the textbox to the cell below the pivot table. This is definitely not perfect, but you might be able to adapt the idea. If the data expands or contracts the width, the size will not match, but someone may offer an answer to that.

datatoo

Posted 2013-01-13T23:17:35.050

Reputation: 3 162

@AlexN. hope it will be adaptable to what you want. good luck – datatoo – 2013-01-25T21:20:32.203