Thread: Adding a Button
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 6,953
Default Adding a Button

something along these lines:

Sub AD()
With Cells(Cells(Rows.Count, 1).End(xlUp).Row, 10)
Set btn = ActiveSheet.Buttons.Add( _
Left:=.Left, _
Top:=.Top, _
Width:=.Resize(1, 3).Width, _
Height:=.Height)
End With
btn.OnAction = "MyMacro"
End Sub

--
Regards,
Tom Ogilvy



" wrote:

How can I add a button {from form controls} to the active sheet if I
want it to be in a specific position? Ideally, I want the button to be
aligned in one row and contained between three columns - my problem is
that I won't know before hand which row I want to restrict by.

The sheet I'm dealing with will have a variable amount of data every
time it is generated by my code, and I always want the button to be at
the end of the data.

Any ideas?
-bgetson