Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Embed Command Button in Cell
Hello,
I would like to set a command button or other control inside a worksheet cell. Essentially I am hoping ot have a clearly identifable button which sits in the space of a particular cell. Does anyone know if this is possible? Thanks for your help! |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Embed Command Button in Cell
Following should size your control to a cell and set its "Move and Size"
property Sub test() Dim obj As Object Set obj = Selection ' eg, Forms button, rectangle etc ' maybe a Controls Toolbox button 'Set obj = ActiveSheet.OLEObjects("CommandButton1") ' some shape ' Set obj = ActiveSheet.Shapes("Rectangle 6") If TypeName(obj) = "Shape" Then Set obj = obj.DrawingObject SizeToCell obj, Range("D4") ' optionally set to a cell End Sub Sub SizeToCell(dwo As Object, Optional rTopLeft As Range) Dim c As Range With dwo If rTopLeft Is Nothing Then Set c = .TopLeftCell Else Set c = rTopLeft End If .Left = c.Left .Top = c.Top .Width = c.Width .Height = c.Height .Placement = xlMoveAndSize End With End Sub Regards, Peter T "Bythsx-Addagio" wrote in message ... Hello, I would like to set a command button or other control inside a worksheet cell. Essentially I am hoping ot have a clearly identifable button which sits in the space of a particular cell. Does anyone know if this is possible? Thanks for your help! |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Command button depending on Cell Value | Excel Discussion (Misc queries) | |||
Embed command button from the control toolbox doesnt work | Excel Worksheet Functions | |||
Embed command button from the control toolbox doesnt work | Excel Worksheet Functions | |||
Embed Graphic onto custom command | Excel Programming | |||
How I disable a command button until cell has value? | Excel Programming |