title: Excel - Deleting images when deleting a row
body: <p>I have a macro that imports images from a directory and places them in Excel cells that are made just big enough to fit the image in.</p>
  <p>A snippet of the macro is below:-</p>
  <pre><code>'Set the Row Height and Column Width of the thumbnail
  
  Range(&quot;A&quot; &amp; CStr(currRow)).RowHeight = ThumbnailSizeRef + 2 
  
  Columns(&quot;A&quot;).ColumnWidth = (ThumbnailSizeRef - 5) / 5 'Column Width uses a font width setting, this is the formula to convert to pixels
  
  'Add the thumbnail
  Set sShape = ActiveSheet.Shapes.AddPicture(Filename:=sFilename, LinktoFile:=msoFalse, SaveWithDocument:=msoTrue, Left:=0, Top:=0, Width:=ThumbnailSizeRef, Height:=ThumbnailSizeRef)
  
  'Set the Left and Top position of the Shape
  sShape.Left = Range(&quot;A&quot; &amp; CStr(currRow)).Left + ((Range(&quot;A&quot; &amp; CStr(currRow)).Width - sShape.Width) / 2)
  
  sShape.Top = Range(&quot;A&quot; &amp; CStr(currRow)).Top + ((Range(&quot;A&quot; &amp; CStr(currRow)).Height - sShape.Height) / 2)
  </code></pre>
  <p>This all works fine.  The images display correctly just in the cell as required.  I can sort the cells successfully also and the images get moved correctly.</p>
  <p>The problem I have is when I delete an entire row (right click on the row and delete), in this situation the image from the row I'm deleting jumps down and hides behind the image on the next row.</p>
  <p>Is there any way that when I delete the row the image gets deleted as well?</p>