I'm writing a macro for powerpoint that pulls information from two different
Excel spreadsheets and then displays the pertinent information in a table.
I've gotten up to the point where the computer can find the correct data and
display it in a message box, but I would like for the powerpoint to populate
my table (depending on the name of the person I click) automatically.
Basically, what I need to do is make my code dynamic. It would be nice if I
could make it so that when you click on a person's name, the table appears
with the correct data, and then if you click on something else, the table
will disappear. Does anyone know how to do this? I've pasted my code thus far
below (not everything--meaning, no spreadsheet stuff. Just the stuff for
powerpoint!). Thanks a LOT!!!

Sub dynamictable()

Dim oTbl As Table
Dim lRow As Long
Dim lCol As Long

' Get reference to table:

Set oTbl = ActiveWindow.Selection.ShapeRange(1).Table
With oTbl

For lRow = 1 To .Rows.Count
For lCol = 1 To .Columns.Count
With .Cell(lRow, lCol).Shape

' Do something with each cell's text
If .HasTextFrame Then .TextFrame.TextRange.Text =
headCounts
If .TextFrame.HasText Then
Debug.Print .TextFrame.TextRange.Text
End If

' set the fill color:
.Fill.Visible = msoTrue
.Fill.ForeColor.RGB = RGB(0, 0, 255)

End With
Next ' column
Next ' row

End With