View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Don Wiss Don Wiss is offline
external usenet poster
 
Posts: 300
Default Can I put buttons on a sheet without selecting?

I'd prefer if this macro added the buttons without selecting the sheet. And
even work if another workbook is active.

Sub AddButtonsToPage()

Application.ScreenUpdating = False
ThisWorkbook.Activate
Sheets("BondCalc").Select

If ActiveSheet.Shapes.Count = 0 Then
ActiveSheet.Buttons.Add(400, 20, 170, 23).Select
Selection.OnAction = "CopyBondCalcSheet"
Selection.Characters.Text = "Put Page Contents into Clipboard"

ActiveSheet.Buttons.Add(400, 55, 72, 23).Select
Selection.OnAction = "ClearBondCalcSheet"
Selection.Characters.Text = "Clear Page"
End If

Range("A1").Select

End Sub

Is it possible?

Don. www.donwiss.com (e-mail link at home page bottom).