Consulting

Page 2 of 2 FirstFirst 1 2
Results 21 to 23 of 23

Thread: Variable Array based on cell value

  1. #21
    VBAX Master Aflatoon's Avatar
    Joined
    Sep 2009
    Location
    UK
    Posts
    1,720
    Location
    That's the old code. Can you post the latest code you were trying?
    Be as you wish to seem

  2. #22
    Here it is:
    On Error Resume Next 
    Sheets("Home").Visible = True 
    TotalSlides = Range("I1").Value 
     
    Set tb = Worksheets("Home").ListObjects("tblCopy") 
    With tb.DataBodyRange 
        ReDim MyRangeArray(.Rows.Count - 1)
          ReDim MySlideArray(.Rows.Count - 1) 
         
        For n = 1 To .Rows.Count 
            Set MyRangeArray(n - 1) = Worksheets(.Cells(n, 1).Value).Range(.Cells(n, 2).Value) 
            MySlideArray(n - 1) = .Cells(n, 3).Value  'PS: it did not work with "set" either.
    
        Next 
    End With 
     
    (...) 
     
    'Make PowerPoint Visible and Active
    PowerPointApp.ActiveWindow.Panes(2).Activate 
     
    'Create a New Presentation
    Set myPresentation = PowerPointApp.ActivePresentation 
    'Loop through Array data
    For x = LBound(MyRangeArray) To UBound(MyRangeArray) 
        'Copy Excel Range
        MyRangeArray(x).Copy 
         
       'Paste to PowerPoint and position
        On Error Resume Next 
        Set shp = myPresentation.Slides(MySlideArray(x)).Shapes.PasteSpecial(DataType:=2)  'Excel 2007-2010
       '  Set shp = PowerPointApp.ActiveWindow.Selection.ShapeRange 'Excel 2013
        On Error GoTo 0

  3. #23
    ahhhhhh i've just closed and opened the excel and ppt, and it worked! Many Thanks again! I hope not to disturb you again kkk
    thanks!

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •