VBA Powerpoint: add list number in a column table

Luis Diaz
Luis Diaz used Ask the Experts™
Hello Experts,
I have the following procedure that I use in my personal.xlsb in order to quickly add list number in an specific column:
Sub Add_List_Number()
Dim strCol As String
Dim lngLastRow As Long
Dim lngRow As Long
Dim intPos As Integer
Dim strPrefix As String

strCol = InputBox("Please enter the column letter in which you add specific row number", "Choose Column Letter")
lngLastRow = Cells.Find("*", SearchOrder:=xlByRows, SearchDirection:=xlPrevious).row

    For lngRow = 1 To lngLastRow
    Cells(lngRow, strCol).Value = lngRow
End Sub

Open in new window

I would like to take it as a reference to add list number in a column table in power point. Every time when a set up table in power point I use list number and when I add additional row I need to retype list number manually. I would like to add this procedure in my powerpoint add in in order to avoid to perform this task manually.

Thank you again for your feedback.
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
In PowerPoint there  are limited options for vba event codes. Check the below code it will insert serial number to a PowerPoint  table in 1st column. make sure to select the table before running.

Sub TableSerialnumbers()

    Dim Shp As Shape
    Dim oTbl As Table
    Dim RowsCount As Long
    Dim ColumnsCount As Long

'Select the table before running the code, code will place serial number to the 1'st column

    Set Shp = ActiveWindow.Selection.ShapeRange(1)
    With Shp
If .HasTable Then
            Set oTbl = Shp.Table
            With oTbl
                'Debug.Print .Rows.Count
                'Debug.Print .Columns.Count

                For ColumnsCount = 2 To .Rows.Count

                    With .Cell(ColumnsCount, 1)
                    .Shape.TextFrame.TextRange.Text = ColumnsCount - 1
                    End With
                End With
End If
            End With
End Sub

Open in new window

Luis DiazIT consultant


It works! Thank you very much for your help.
I take the opportunity to ask you your advice concerning the best add-in in powerpoints that can help me to be more productive in powerpoint in terms of formatting, alignement, shortcuts etc..
Honestly I never tried using addins ever in ms office apps my preference is always vba.
I recommend you this site for PowerPoint vba: http://www.pptfaq.com/FAQ00033_How_do_I_use_VBA_code_in_PowerPoint.htm

And for addons I found this article useful after googling "powerpoint add ins"

Ensure you’re charging the right price for your IT

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden using our free interactive tool and use it to determine the right price for your IT services. Start calculating Now!

Luis DiazIT consultant


Noted, thank you. Last question: if you don't use add in how do you call recurrent procedures in PPT vba as in PPT there is not available the personal.xlsb as excel?
I normally store the codes in same file, but for your case you can create master file as Macro enabled format .pptm and then keep this file opened to call procedures from whenever you need them.
Luis DiazIT consultant


Noted. Thank you for those advices.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial