(Solved) – vba macro to create column to the right of a table

(solved)-–-vba-macro-to-create-column-to-the-right-of-a-table

I currently have a table called AA_Table, this is in a sheet called AA. My current vba code creates a column right next to the table, this is currently working fine. However it is cell based, so if my AA_Table has a different number of columns, then the macro doesn’t do what I want it to do.

This is the current vba code:

Sheets("AA").Select
    Range("BY1").Select
    ActiveCell.FormulaR1C1 = "Total Hours"
    Range("BY2").Select
    ActiveCell.FormulaR1C1 = _
        "my formula goes here"

How could I modify this code so that it doesn’t always choose cell BY2, but instead the cell to the right of my AA_Table

Thanks.

Leave a Reply

Your email address will not be published. Required fields are marked *