Consulting

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

Thread: Solved: Regroup Tables?

  1. #21
    VBAX Expert TrippyTom's Avatar
    Joined
    Jul 2005
    Location
    New York, NY (USA)
    Posts
    556
    Location
    Ok, just to make sure I know what's going on:

    [vba]Istart = Int(Right$(.Name, Len(.Name) - 10))[/vba] This line basically takes the name of the selected shape, parses the number out of it and assigns it to Istart. So basically I can't select a shape with a name more than 99 (god I hope I never have a table with that many cells!)

    That part I understand (clever by the way)..

    This is where I got confused:
    [vba]For iC = 1 To .Columns.Count
    .Cell(iR, iC).Shape.TextFrame.TextRange = osld.Shapes("Rectangle " & CStr(Istart + adj)).TextFrame.TextRange
    osld.Shapes("Rectangle " & CStr(Istart + adj)).Delete
    adj = adj + 1
    Next iC[/vba] What does the CStr(Istart + adj)) part of that code do? What is adj for?
    Office 2010, Windows 7
    goal: to learn the most efficient way

  2. #22
    VBAX Master
    Joined
    Feb 2007
    Posts
    2,093
    Location
    Point 1
    It should parse any number It basically takes the name and strips out "Rectangle " (10 letters inc the space)

    Point 2
    The adj(ust) just adds one to the number for each new cell. CStr converts the number to a string

    eg
    "Rectangle " & CStr(6) = "Rectangle 6"
    then "Rectangle 7"
    then "Rectangle 8" etc

    This puts the correct textrange into the correct cell (hopefully)

    Note this will hardly ever start at Rectangle 1 because of the way PPT names shapes (in the testing I was on Rectangle 297!!)
    Last edited by John Wilson; 04-01-2009 at 06:00 AM.
    John Wilson
    Microsoft PowerPoint MVP
    Amazing Free PowerPoint Tutorials
    http://www.pptalchemy.co.uk/powerpoi...tutorials.html

  3. #23
    VBAX Sage
    Joined
    Apr 2007
    Location
    United States
    Posts
    8,711
    Location
    John -- I am consistantly impressed by your knowledge of the nuances of PP and getting VBA to do things


    You are NOT allowed to ever let your VBX membership expire

    Paul

  4. #24
    VBAX Master
    Joined
    Feb 2007
    Posts
    2,093
    Location
    The beer tasted good!
    John Wilson
    Microsoft PowerPoint MVP
    Amazing Free PowerPoint Tutorials
    http://www.pptalchemy.co.uk/powerpoi...tutorials.html

Posting Permissions

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