1
votes

First my source looks like this:

enter image description here

I want the 2 sub-ranges (let's say "A3:C6" & "A8:C11") to be pasted on one powerpoint slide side by side. This is for one worksheet. There are 6 such sheets all with same range.

I learnt how to use PageSetup property to change object dimensions (code posted here) but i'm not able to write a for loop to paste each sub-range to each corner of a slide. And extend that for loop to all 6 sheets in my workbook. Can anyone help me please?

1
Those 6 sheets are the first 6 sheets in your workbook? How do you plan to select those sheets? For Ex: Write sheet names in a range or run loop on first 6 sheets. Moreover How will you give range to the loop, Is there any pattern or you will write range names in a separate sheet and then run loop?Script Developer

1 Answers

1
votes

This is a generalized solution: You have to add sheet names in mySheet array below and also you have to add range names to the myRange array below:

Sub stackOverflow()

Dim myRange(1 To 12) As String
Dim mySheet(1 To 6) As Worksheet

myRange(1) = "A3:C6"
''Define all ranges like above line
Set mySheet(1) = ThisWorkbook.Worksheets("Sheet1")
''Define all sheets like above line
j = 1
For i = 1 To 6
    mySheet(i).range(myRange(j)).Copy
    ''code to paste range in powerpoint
    j = j + 1
    mySheet(i).range(myRange(j)).Copy
    ''code to paste range in powerpoint
    j = j + 1
Next i
End Sub