Hi! I have this code below. 1st sheet has 7 columns: 1st column is time and the rest are the A,B,C,D,E,F. I'm trying to create new sheets for all A - F together with the timing set at 12:00. After that, I want to paste the charts into only One PowerPoint Presentation with Six Slides. My code below works fine till vba create the 4th sheet in the same workbook and the 5th and 6th sheets does not appear. Furthermore, I only get 3 PowerPoint slides A,B,C and I dont see the rest D,E,F. I am very confused since it work fine for the 1st few sheets and 1st few slides, shouldn't it work for the rest of the sheets and slides?

I googled and utube line by line and tinker some of the code so you know how much i know of this vba. Please help! Thanks in advance.





Sub ProjectForFun()
Dim sh As Worksheet
Set sh = ThisWorkbook.Sheets("AllforVba")
Dim SheetForCopy As Worksheet

sh.AutoFilterMode = False   'Setting Excel sheet to have no filters
sh.UsedRange.AutoFilter 1, "12:00"

Set Sheet = Sheets.Add(after:=Sheets(Sheets.Count))  'Adding a new worksheet
ActiveSheet.Name = "SheetForCopy"  'Naming the new worksheet

sh.UsedRange.Copy Worksheets("SheetForCopy").Range("A1")    'copy previous worksheet's data to new worksheet
Worksheets("SheetForCopy").Activate    'make new worksheet the active sheet

'Delete Column with 12:00
Sheets("SheetForCopy").Range("A:A").Delete

'Inserting a new column at column A and inserting serial numbers
Dim LR As Long
LR = Range("A" & Rows.Count).End(xlUp).Row
Columns("A:A").Insert Shift:=xlToRight
Range("A2").FormulaR1C1 = "1"
Range("A2").DataSeries Rowcol:=xlColumns, Type:=xlLinear, Date:=xlDay, Step:=1, Stop:=LR - 1, Trend:=False

Set Sheet = Sheets.Add(after:=Sheets(Sheets.Count))  'Adding a new worksheet
'ActiveSheet.Name = Workbook.Sheets.Name '"SheetNumber"  'Naming the new worksheet

Worksheets("SheetForCopy").Activate    'make new worksheet the active sheet
Columns("A:B").Copy    'copy previous worksheet's data to 'new worksheet
Sheets(Sheets.Count).Select
Columns("A").Select
ActiveSheet.Paste

Dim i As Long   'rows
Dim j As Long   'columns

i = Cells(Rows.Count, 1).End(xlUp).Row

   With ActiveSheet.Shapes.AddChart.Chart
   .ChartType = xlLineStacked
  '.SeriesCollection.NewSeries
        'With .SeriesCollection(1)
       '.Name = "=" & ActiveSheet.Name & "!" & _
        'Cells(1, 2).Address
       '.XValues = "=" & ActiveSheet.Name & "!" & _
        'Range(Cells(2, 1), Cells(i, 1)).Address
       '.Values = "=" & ActiveSheet.Name & "!" & _
       'Range(Cells(2, 2), Cells(i, 2)).Address
        End With

'Declare PowerPoint Variables
Dim PPTApp As New PowerPoint.Application
Dim PPTPres As PowerPoint.Presentation
Dim PPTSlide As PowerPoint.Slide
Dim SldIndex As Integer
'Declare Excel Object Variables
Dim Chrt As ChartObject
'Create a new instance of PowerPoint
Set PPTAppt = New PowerPoint.Application
PPTApp.Visible = True

'Create a new Presentation within the Application
Set PPTPres = PPTApp.Presentations.Add
'Create an index handler for slide creation
SldIndex = 1

Sheets(Sheets.Count).Select
'Loop through all the Chart Objects on the ACTIVESHEET
For Each Chrt In ActiveSheet.ChartObjects       'This works!!!!
'Copy the chart
Chrt.Copy
Next Chrt

Dim SheetNumber As Long
For SheetNumber = 1 To Application.Sheets.Count

'Create a new slide, set the layout to blank and paste the slide on the slide.
Set PPTSlide = PPTPres.Slides.Add(SldIndex, ppLayoutBlank)
PPTSlide.Shapes.Paste
'Increment our slide index
SldIndex = SldIndex + 1

Sheets("SheetForCopy").Activate
Columns("B:B").Delete
Application.DisplayAlerts = True

Columns("A:B").Copy    'copy previous worksheet's data to 'new worksheet
Set Sheet = Sheets.Add        'Adding a new worksheet
Columns("A").Select
ActiveSheet.Paste

With ActiveSheet.Shapes.AddChart.Chart
   .ChartType = xlLineStacked
 
        End With

For Each Chrt In ActiveSheet.ChartObjects       'This works!!!!
'Copy the chart
Chrt.Copy
Next Chrt

Next SheetNumber


End Sub