Hi,
I've created a macro which selects cells, sorts by one column high to low, then selects a range of cells, pastes in a different cell as a picture, names that picture, then opens powerpoint, selects a slide then, selects the named picture and pastes into position on the slide.
This is then repeated to fill content on 24 slides with upto 6 pictures pasted on each slide.
My understanding is that I've used select and activate too much and is therefore now bugging on the ActiveSheet.Pictures.Paste.Select part of the macro, the debug always highlights this bit of code but not always on the same sub, there are 24 subs.
I would be really grateful if anyone could help me on this.
Working from Excel 2016, windows operating system.
The VBA is as below - although I've only included one slide(sub) which repeated bugs out.
Hope you guys can help,
Ellie
I've created a macro which selects cells, sorts by one column high to low, then selects a range of cells, pastes in a different cell as a picture, names that picture, then opens powerpoint, selects a slide then, selects the named picture and pastes into position on the slide.
This is then repeated to fill content on 24 slides with upto 6 pictures pasted on each slide.
My understanding is that I've used select and activate too much and is therefore now bugging on the ActiveSheet.Pictures.Paste.Select part of the macro, the debug always highlights this bit of code but not always on the same sub, there are 24 subs.
I would be really grateful if anyone could help me on this.
Working from Excel 2016, windows operating system.
The VBA is as below - although I've only included one slide(sub) which repeated bugs out.
Code:
'############################### Slide 22 Digital #################################
Sub slide_22()
Sheets("Slide22").Select
'Sorting by percentage
'SOME_1
Range("BL2:BV34").Sort key1:=Range("BV2"), _
order1:=xlDescending, Header:=xlYes
'sorting by combination formula
'SOME_2
Range("V2:AG25").Sort key1:=Range("AG2"), _
order1:=xlDescending, Header:=xlYes
' Naming the boxes
Range("AK27:AM31").Select
Selection.Copy
Range("AK36").Select
ActiveSheet.Pictures.Paste.Select
Selection.ShapeRange.name = "SOME_2"
Range("CT2:CV7").Select
Selection.Copy
Range("CT10").Select
ActiveSheet.Pictures.Paste.Select
Selection.ShapeRange.name = "SOME_4"
''''''''' pasting it all
'first part: standard code, copy and paste
Dim PPApp As PowerPoint.Application
Dim PPPres As PowerPoint.Presentation
Dim iCht As Integer
Application.CutCopyMode = False
Set PPApp = GetObject(, "Powerpoint.Application")
Set PPPres = PPApp.ActivePresentation
' define spreadsheet
Sheets("Slide22").Select
' Paste the shapes individually
ActiveSheet.Shapes("SOME_1").Copy
With PPPres.Slides(22)
.Shapes.Paste
With .Shapes(.Shapes.Count)
.Left = 0.05 * 28.34
.Top = 3.43 * 28.34
End With
End With
ActiveSheet.Shapes("SOME_2").Copy
With PPPres.Slides(22)
.Shapes.Paste
With .Shapes(.Shapes.Count)
.Left = 0.85 * 28.34
.Top = 10.45 * 28.34
End With
End With
ActiveSheet.Shapes("SOME_4").Copy
With PPPres.Slides(22)
.Shapes.Paste
With .Shapes(.Shapes.Count)
.Left = 16.29 * 28.34
.Top = 10.85 * 28.34
End With
End With
End Sub
Hope you guys can help,
Ellie