Paste Excel Ranges into Powerpoint slides at specified slide locations

BuJay

Board Regular
Joined
Jun 24, 2020
Messages
75
Office Version
  1. 365
  2. 2019
  3. 2016
  4. 2013
Platform
  1. Windows
I have a bunch of excel tables defined as named ranges, for Port_Table_1a, Port_Table_1b, Port_Table_1c, ...., all the way until Port_Table_22a, Port_Table_22b, and Port_Table_22c.

I also have an existing powerpoint with many slides.

How would I do the following:

  1. Open the powerpoint (I can do this with below code)
  2. Copy the first range (Port_Table_1a) from excel (I can do this with below code)
  3. Copy slide 5 from the open PowerPoint and insert it in the next slide location, so pasted into what would now by slide 6 and the previous slide 6 would now be moved to slide 7, etc.
  4. If there are any charts on the pasted slide 6, delete them
  5. Paste the first named range as an HTML into the new slide 6 centered vertically and horizontally
  6. Copy the second range (i.e., Port_Table_1b) from excel
  7. Copy slide 11 from the open PowerPoint and insert it in the next slide location, so pasted into what would now by slide 12 and the previous slide 12 would now be moved to slide 13, etc.
  8. If there are any charts on the pasted slide 12, delete them
  9. Paste the second named range as an HTML into the new slide 12 centered vertically and horizontally
...then this would be repeated until all named ranges are pasted into slides


Sub Macro1()
Range("Port_Table_1a").Select
Selection.Copy
End Sub

Sub OpenExistingPPTX()

Dim ppt As PowerPoint.Application
Set ppt = New PowerPoint.Application
ppt.Visible = True

ppt.Presentations.Open ("path")

Dim ppres As PowerPoint.Presentation
Set ppres = ppt.ActivePresentation

'Count number of slides in presentation
Debug.Print ppres.Slides.Count

End Sub
 

Excel Facts

Excel motto
Not everything I do at work revolves around Excel. Only the fun parts.
Upvote 0
Yes, posting in other locations is fine. When you do so, though, you should let the members here know that you've done so. I think it's part of the rules here. Also, I think most people might not appreciate having spent time providing a solution, only to find out that you already have one. ;)

Cheers!
 
Upvote 0
Cross-posting (posting the same question in more than one forum) is not against our rules, but the method of doing so is covered by #13 of the Forum Rules.

Be sure to follow & read the link at the end of the rule too!

Cross posted at: link already provided.
There is no need to repeat the link(s) provided above but if you have posted the question at other places, please provide links to those as well.

If you do cross-post in the future and also provide links, then there shouldn’t be a problem.
 
Upvote 0

Forum statistics

Threads
1,223,893
Messages
6,175,242
Members
452,623
Latest member
russelllowellpercy

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top