将Excel范围复制到PowerPoint中与相邻图片相同的幻灯片上 [英] Copy excel ranges onto same slide in powerpoint as adjacent pictures
问题描述
首先,我的来源如下:
我希望将2个子范围(比如说"A3:C6"和"A8:C11")并排粘贴到一个幻灯片上.这是一个工作表.有6个这样的表都具有相同的范围.
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.
我学习了如何使用 PageSetup
属性更改对象尺寸(此处发布的代码)但我无法编写 for
循环将每个子范围粘贴到幻灯片的每个角.并将该 for
循环扩展到我的工作簿中的所有6张纸上.有人可以帮我吗?
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?
推荐答案
这是一个通用的解决方案:您必须在下面的mySheet数组中添加工作表名称,并且还必须在下面的myRange数组中添加范围名称:
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
这篇关于将Excel范围复制到PowerPoint中与相邻图片相同的幻灯片上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!