Count Pivot Tables and add a table

Important Notice

Please note that on 14th December 2023 users will experience an expected outage whilst we make upgrades to our network. We anticipate this process may take a couple of hours and so we apologise in advance for any inconvenience.

  • Hello forum,

    I have a weekly Excel workbook with a separate Sheet for each workday. Each Sheet has data that I want to convert into a table with VBA. I recorded the code below but it will not function correctly after the first sheet is saved. The error message comes back with "a table can't overlap another table". Is there a way to count the number of current tables in the workbook and have VBA create a new table with the next Table#?

    I appreciate your feedback,

    Thank you

  • Sorry, I don't understand your reply. Was my question confusing? I want to create a table in excel using a macro but if I already have a table in the workbook the macro I recorded does not work.

  • It's poor workbook design to have data separated on different sheets.

    Your code will only work on the ActiveSheet and on the specified range, if a Table already exists there you will get that error message.

    You need to loop through the sheets check if a Table exists and create the Table if not.

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!