0

I am currently working on excel database using macro. I can't figure out how to automatically generate a button in every new inserted data. I want the buttons to display only when the rows have data inserted.

Once the button is generated, I will assign a macro that will copy the selected row to another sheet.

I want to achieve something like this.

enter image description here

Thank you in advance.

1 Answers1

0

I just opened the Developer Tab and recorded a Macro of me Adding a Button Control to Excel in Cell F3.

Then I adjusted the left argument to 10 (Cell A3) and ran the Macro1 code and then clicked the button in Cell A3:

Sub Macro1()
    ActiveSheet.Buttons.Add(10, 32.4, 40.8, 8.4).Select
    Selection.OnAction = "MethodButtonCalls"
End Sub

Private Sub MethodButtonCalls()
MsgBox ("It Works")
End Sub

And hey presto: enter image description here

Here's how you get the buttons Row: https://stackoverflow.com/a/21545710/495455

Jeremy Thompson
  • 61,933
  • 36
  • 195
  • 321