View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Dave Peterson Dave Peterson is offline
external usenet poster
 
Posts: 35,218
Default Set Command button location

Dim myRng As Range
Dim myCmdBtn As OLEObject

Set myRng = Worksheets("Sheet1").Range("c9") '"C9:d10" ???

With myRng
Set myCmdBtn = .Parent.OLEObjects.Add _
(ClassType:="Forms.CommandButton.1", _
Link:=False, _
DisplayAsIcon:=False, _
Left:=.Left, _
Top:=.Top, _
Width:=.Width, _
Height:=.Height)
End With

myCmdBtn.Object.Caption = "Click Me"



jswalsh33 wrote:

I would like to be able to set the location of a command button on an Excel
worksheet with macro code. Can that be done?

Thanks for your help,

Jim Walsh


--

Dave Peterson