Я хотел бы добавить лист Excel с диапазоном в массив VBA и применить к нему фильтрацию.Затем я печатаю это как изображение в PowerPoint.Как применить метод Range.AutoFilter в массиве MyRangeArray?
'Create a New Presentation
Set myPresentation = PowerPointApp.ActivePresentation
'List of PPT Slides to Paste to
MySlideArray = Array(2, 3, 4, 5, 6, 7)
'List of Excel Ranges to Copy from
MyRangeArray = Array(Sheet1.Range("A6:P28"), _
Sheet4.Range("B6:P17"), _
Sheet6.Range("B6:P16"), _
Sheet9.Range("C6:P15"), _
Sheet11.Range("B6:P14"), _
Sheet16.Range("B6:P14"))
'Loop through Array data
For x = LBound(MySlideArray) To UBound(MySlideArray)
'Copy Excel Range
MyRangeArray(x).CopyPicture
'Paste to PowerPoint and position
On Error Resume Next
Set shp = myPresentation.Slides(MySlideArray(x)).Shapes.PasteSpecial
On Error GoTo 0
With myPresentation.PageSetup
'Lock Aspect Ratio
shp.LockAspectRatio = msoTrue
'Assign Height Width
shp.Height = 11.16 * 28.3465
shp.Width = 23.88 * 28.3465
'Assign Position
shp.Left = 0.75 * 28.3465
shp.Top = 2.7 * 28.3465 ' 28.3465 points=1cm
End With
Next x
Я ожидаю, что фильтр будет применен к выбранному диапазону ячеек в выбранном Листе.