View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
Paul Robinson Paul Robinson is offline
external usenet poster
 
Posts: 208
Default Make a cell into a Macro button

Hi
This will do it on cell A1 in the active sheet

Sub MakeButton()
Dim myButton as Button

ActiveWindow.Zoom = 100 'if not, there may be an alignment problem
when date buttons are clicked
With Activesheet.Range("A1")
Set myButton = ActiveSheet.Buttons.Add (.Left, .Top, .Width,
..Height)

With myButton 'change properties as required
.Placement = xlMove
.Caption = "mytext"
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom
.Orientation = xlUpward
.OnAction = "myMacro"
End With 'myButton
End With ' 'Range "a1"
'Scroll to the button
Application.GoTo Reference:=Activesheet.Range("A1") _
, Scroll:=True
Set myButton = Nothing
end sub

regards
Paul
"Al" <al_dempsey@hotmail wrote in message ...
How do I turn a specfic cell into a button that when
pressed runs a specific macro?


Thx in Advance,
Al