?
Solved

Is It Possible To Have A Shape Move Down A Sheet As A Table's Dynamic Range Expands?

Posted on 2013-06-12
5
Medium Priority
?
263 Views
Last Modified: 2013-06-12
I have a table in a spreadsheet. When you get to the last cell in the table, if you press 'tab' a new row is added to the table. I also have a shape below the table. As the table range increases, it eventually overtakes the shape and either is hidden by it or hides the shape, depending on the level of the layer. I have the shape set to be moved with cells, but unfortunately the table doesn't create a new row when it expands it's range - it just takes the next existing row and adds it to the table. I have googled this and can't find anything, which is weird because I feel like this isn't that outlandish of a request. I just want my shape to move down with my table so that they maintain the original layout as the table expands.  Is this possible?
0
Comment
Question by:Animaldrummer04
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 93

Accepted Solution

by:
Patrick Matthews earned 1000 total points
ID: 39242040
Try using this in the sheet module for the worksheet you need "watched":


Private Sub Worksheet_Change(ByVal Target As Range)
    
    Dim tbl As ListObject
    Dim shp As Shape
    Dim TblLastRow As Long
    
    Set tbl = Me.ListObjects("MyTable") 'rename as needed
    Set shp = Me.Shapes("Fred") 'rename as needed
    
    With tbl
        TblLastRow = .Range.Rows(.Range.Rows.Count).Row
    End With
    
    With Me.Rows(TblLastRow)
        shp.Top = .Top + .Height + 10 'or use more or less space to separate them
    End With
    
End Sub

Open in new window

0
 

Author Comment

by:Animaldrummer04
ID: 39242408
Thank you for that, that does work. However, is there a way to get the shape to move down as soon as the new row is created? As it is written, the code uses the last row with data in the table, so when a new row is created the table doesn't move until something is typed into that row. And is the only way to do this with VBA/macro?
0
 

Author Comment

by:Animaldrummer04
ID: 39242425
I attached the workbook i tested the solution out with, if that's helpful.
test.xlsm
0
 
LVL 93

Expert Comment

by:Patrick Matthews
ID: 39242512
>>is there a way to get the shape to move down as soon as the new row is created?

No

>>And is the only way to do this with VBA/macro?

Yes
0
 

Author Closing Comment

by:Animaldrummer04
ID: 39242708
Thanks! Not exactly what i was looking for, but it seems as if what i was looking for is impossible.
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article helps those who get the 0xc004d307 error when trying to rearm (reset the license) Office 2013 in a Virtual Desktop Infrastructure (VDI) and/or those trying to prep the master image for Microsoft Key Management (KMS) activation. (i.e.- C…
Outlook for dependable use in a very small business   This article is about using the Outlook application (part of Microsoft Office) in a very small business, or for homeowners where dependability and reliability are critical requirements. This …
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question