Consulting

Results 1 to 4 of 4

Thread: Checklist: When table cell is clicked, make it green / white (not headers)

  1. #1
    VBAX Regular
    Joined
    Jan 2016
    Posts
    10
    Location

    Checklist: When table cell is clicked, make it green / white (not headers)

    I have a simple table, 5 rows x 5 columns.
    The uppermost row and the leftmost column contains headers

    y y y y y
    z x x x x
    z x x x x
    z x x x x

    Each x cell contains some kind of text.

    I want to create a simple checklist where if I click cell x, that cell will become green (if not green) and the text inside becomes white.
    When I click the cell again, I want the green cell to revert back to white and the text to black

    Also the file should automatically save (not save as) when cell is clicked.

    I would like the macro to run directly when opening the powerpoint file.

    Total newbie at VBA so don't know how to do this?
    Last edited by jokris; 03-23-2019 at 10:56 AM. Reason: more info

  2. #2
    VBAX Master
    Joined
    Feb 2007
    Posts
    2,093
    Location
    That would be quite a job for a newbie

    There's no way to click on a table cell and tell the code which cell has been clicked.

    Probably the only way would be to have code that runs at the start of the show and adds transparent shapes over each cell to trigger the code and removes them again when the show terminated. Not at all easy!
    John Wilson
    Microsoft PowerPoint MVP
    Amazing Free PowerPoint Tutorials
    http://www.pptalchemy.co.uk/powerpoi...tutorials.html

  3. #3
    VBAX Expert Logit's Avatar
    Joined
    Sep 2016
    Posts
    613
    Location
    .
    If I correctly understand your goal ... and albeit the below is for Excel .. hopefully it can transfer somehow to PowerPoint ?


    I created a table from A1:E6 called TABLE1.

    Then paste this macro into the worksheet module :

    Option Explicit
    
    
    Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
    Dim Table1 As Range
    Dim KeyCells As Range
    
    
    If Not Intersect(Target, Range("A2:E6")) Is Nothing Then
    
    
        With Table1
            If Target.Cells.Interior.Color = vbWhite Then
                Target.Cells.Interior.Color = vbGreen
                Target.Cells.Font.Color = vbWhite
            ElseIf Target.Cells.Interior.Color = vbGreen Then
                Target.Cells.Interior.Color = vbWhite
                Target.Cells.Font.Color = vbBlack
            End If
        End With
    
    
    Else
    
    
        Exit Sub
    
    
    End If
        
    
    
    End Sub

  4. #4
    VBAX Master
    Joined
    Feb 2007
    Posts
    2,093
    Location
    You cannot use code like that in PowerPoint sadly.
    John Wilson
    Microsoft PowerPoint MVP
    Amazing Free PowerPoint Tutorials
    http://www.pptalchemy.co.uk/powerpoi...tutorials.html

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
  •