[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1736
  • Last Modified:

Merging Cells in a PowerPoint Table

I am trying to find the syntax to merge cells in certain rows in a powerpoint table

There are currently multiple tables in a template that are automatically updated using vba, and sometimes the lists have different number of rows. the code that i use to currently populate the tables is below.

Case 2 - The cell that was just populated needs to have the first 4 cells (including itself) merged.

Any suggestions or ideas on how to do it are greatly appreciated...
Private Sub TableUpdate(strShapeName As String, iRowCount As Integer, iColCount As Integer, iColCopy As Integer, iRowCopy As Integer, bFormat As Boolean)
Dim rngFormat As Range
rngFormat = False

If bFormat = True Then
rngFormat = Range("nrTableFormattingStart")

i = 1   'Row Counter for Paste Section
j = 1   'column Counter for Paste Section
k = iRowCopy
l = iColCopy

    ThisWorkbook.Sheets(SHEETMAIN).Activate
    'Set oPPTShape = strShapeName
    
    Do Until i > iRowCount
        Do Until j > iColCount
                oPPTShape.Table.cell(i, j).Shape.TextFrame.TextRange.Text = Cells(k, l).Text
            Select Case rngFormat
            Case 0
            Case 1
                'shade the background of the cell grey
            Case 2
                'Merge the first 4 cells of the table
                
            Case Else
            End Select
            
            j = j + 1
            l = l + 1
            Set rngFormat = rngFormat.Offset(1, 0)
            
        Loop
        
        i = i + 1
        k = k + 1
        j = 1
        l = iColCopy
        
    Loop
 
End Sub

Open in new window

0
DekkaG
Asked:
DekkaG
1 Solution
 
JSRWilsonCommented:
Assuming i and j are the start row and column the code would be

With opptshape.Table
.Cell(i, j).Merge MergeTo:=.Cell(i, j + 3)
End With

Open in new window

0
 
DekkaGAuthor Commented:
This was exactly what I was looking for. Thanks for the help.
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now