[PowerPoint] Delete multiple rows in a table at once using VBA
Hi,
Anyone can help me how to delete multiple rows in a PowerPoint table at once using VBA?
Background info:
I've created a VBA macro that deletes rows from a table on a PowerPoint slide. It's part of a larger macro that "splits" a table that doesn't fit on a single slide over multiple slides. (The table is generated outside PowerPoint.)
The base process is that it copies the slide with the too long table the required number of times, and then removes the rows that don't apply to that slide. E.g. the table has 75 rows, and I want 25 per slide. The original slide is copied 2x, so that there are 3 slides with the full table. On the first we delete rows 26-75, on the second we delete rows 1-25 and 51-75, and on the third slide rows 1-50.
This works fine for small tables, but a table with 265 rows that has to be split over 10 slides, already takes us 5 minutes to process. On an Intel i9 with 64GB RAM... On an Intel i5 it takes up more than 20 minutes!
The slow part is related to the fact that each row is deleted individually, which apparently creates significant overhead. Because if I manually select 200+ rows, right mouse click, and say delete rows, it only takes a second or two.
Unfortunately I have not been able to find a way to delete multiple rows at once. The Delete-method seems to allow one row-number only, and not a range like e.g. Excel. I thought about selecting multiple rows or cells, but the Selected property is read-only. I thought about setting the row-height to 0, but that doesn't work if there is data in the cells.
Hopefully somebody has an idea!
Thanks in advance,
Erwin
Re: [PowerPoint] Delete multiple rows in a table at once using VBA
i will try to have a look tomorrow
Re: [PowerPoint] Delete multiple rows in a table at once using VBA
it may be faster to break up the table data into units of 25 rows, then populate into tables of 25 rows on the number of slides required
you can add however many slides and add a table of 25 rows to the new slide then populate the table from the data
Re: [PowerPoint] Delete multiple rows in a table at once using VBA
We (unfortunately) have to start with the full table, as it (and the rest of the presentation) is created automatically by another software application. The idea to use a VBA macro is to provide flexibility. E.g. it is unknown up front if there are titles, subtitles, footers, logo's, etc. on the slide. It is also unknown which formatting (among others font size) has been chosen, which impacts the number of rows that fit on the slide.
Re: [PowerPoint] [NOT resolved] Delete multiple rows in a table at once using VBA
So far no luck with finding a solution to speed up the deleting of rows in a table. Strange, since this is lightning fast when done manually...
The conclusion so far is that creating multiple slides with the right size table per slide, and then populating all these tables from scratch with the data in the original table using VBA code is 20+ times faster than deleting the rows...
It's not the solution I was looking for, so if anyone has a good idea how to delete multiple rows in a fast way, I'm still interested to hear.
But for those experiencing the same problem, don't hold your breath, create new tables and copy the data from the original table. ;)
Re: [PowerPoint] Delete multiple rows in a table at once using VBA
IF you can import the table into excel first it would be easy to delete the rows then copy those tables into the slides