View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Mark Ivey[_3_] Mark Ivey[_3_] is offline
external usenet poster
 
Posts: 22
Default macro to add button to a spreadsheet cell

Here is one example you can look over...


Mark Ivey


Sub AddButtonAndMacroToSheet()

' Change this selection as needed
Range("D11").Select

' This will add a button to the activecell
' which was selected in the previous step
ActiveSheet.Buttons.Add(ActiveCell.Left, _
ActiveCell.Top, _
ActiveCell.Width, _
ActiveCell.Height).Select

' This will assign a macro to this button
Selection.OnAction = "Macro1"
End Sub