Skip to main content

Search

Search

Count the rows of a database and position the Y of an object by the number of rows

Comments

1 comment

  • Avatar
    Xabier Clemente
    Moderator

    Hello Andrea,

    Welcome to the BarTender Community Forums!

    You mentioned using VBS to achieve this. However, you can actually achieve this using Excel's built-in features without requiring VBS expertise. Here's how you can do it:

    Anchor the Table to Another Element:

    1. Create the element (e.g., a text box, shape, or cell) that you want to anchor the last row of the table to. Make sure this element is in the desired position.
    2. Select the table.
    3. Go to the "Layout" tab (this might be different depending on your Excel version).
    4. In the "Properties" group, look for an option like "Properties" or "Table Properties." Click it.
    5. Look for an option like "Move but don't size with cells" or "Move with cells." (the naming convention depends on your Excel version) Select this option. This ensures that as rows are added or removed from the table, the last row will always stay anchored to the element.
    6. Set Table to Resize with Data:
    7. Right-click on the table.
    8. Choose "Table Properties."
    9. In the "Table" tab, make sure the "Resize table to fit contents" option is checked. This ensures that the table will adjust its size as you add or remove rows.

    By anchoring the last row to another element and setting the table to resize with its contents, you can achieve the behavior you described without needing to manually calculate row counts and adjust positions using VBS.

    You can learn more about this in the following MS article.

    I hope this helps!

    0

Please sign in to leave a comment.