View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Norman Jones Norman Jones is offline
external usenet poster
 
Posts: 5,302
Default how to create button?

Hi Gin Lye,

Try:

Sub Macro1()
Dim myButton As Button
Set myButton = ActiveSheet.Buttons. _
Add(Left:=10, Top:=10, Height:=50, Width:=50)
myButton.OnAction = "MyMacro"
End Sub


Sub MyMacro()
MsgBox "Hello"
End Sub

Change the Top, Left, Height and Width values to siut.


---
Regards,
Norman




"Daniel" wrote in message
...
Hi,
How to create new button in excel (not in userform) by using vba program.
HOw to assign new macro to the new create button in excell file.

Any ideas, suggestion?

Thanks in advance.

Rgrds,
Gin Lye