• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Is there a way to add "CommandButtons" next to each cell ?

Mr.Karr

Member
Imagine, I've a data table that I send across to my customer for them to select/add specific rows that they feel are ready to be analysed further. Is there a way, I can provide them with command buttons so they can click add and revert ?

SelectTeamGradeScore
AA
95​
BC
78​
DS
85​
FA
83​
GE
85​
KA
82​

Please see sample data file attached.

Much appreciated.
 

Attachments

jolivanes

Member
Code:
Sub Add_Buttons()
Dim c As Range, btn As Object
'  ActiveSheet.Buttons.Delete

    For Each c In Range("A2:A" & Cells(Rows.Count, 2).End(xlUp).Row)
        With c
            Set btn = ActiveSheet.Buttons.Add(c.Left + 4, c.Top + 4, c.Width - 8, c.Height - 8)
                With btn
                    .OnAction = "Add_To_Team_" & c.Offset(, 1).Value
                    .Caption = "Add"
                    .Name = "Button " & c.Row - 1
                End With
        End With
    Next c
End Sub
 
Top