Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Command button depending on Cell Value Steve[_11_] Excel Discussion (Misc queries) 1 January 14th 08 11:34 AM
Embed command button from the control toolbox doesnt work guichre Excel Worksheet Functions 1 November 16th 04 02:28 AM
Embed command button from the control toolbox doesnt work Roland Excel Worksheet Functions 0 November 16th 04 02:20 AM
Embed Graphic onto custom command john m Excel Programming 0 April 6th 04 04:25 PM
How I disable a command button until cell has value? Brian Excel Programming 4 October 21st 03 08:12 PM


All times are GMT +1. The time now is 05:54 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"