ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Question regarding an activex control button (https://www.excelbanter.com/excel-programming/292516-question-regarding-activex-control-button.html)

slim[_2_]

Question regarding an activex control button
 
I created a button on worksheet that will run a macro. All I need to do is
to be able to hide the button when hiding the rows that the button is
located on.

For example, the button is contained on rows 1 & 2 of the sheet...I would
like to be able to hide these two rows, thereby hiding the actual button as
well. Currently, when I hide the two rows, the button will stay in the same
location..now on top of rows 3 & 4.

Is there any way this can be done? Otherwise, is there some other way to
achieve this goal?

Thanks again for everyone's help.



david fixemer

Question regarding an activex control button
 
Slim,

Used my VBA recorder to generate the following code:

ActiveSheet.OLEObjects.Add
ClassType:="Forms.CommandButton.1", Link:=False _
, DisplayAsIcon:=False, Left:=171, Top:=51.75,
Width:=46.5, Height:= _
22.5).Select
With Selection
.Placement = xlMoveAndSize
.PrintObject = True
End With


The key line is:

selection.placement = xlMoveAndSize

David Fixemer

slim[_2_]

Question regarding an activex control button
 
Thanks David..That did it!

"David Fixemer" wrote in message
...
Slim,

Used my VBA recorder to generate the following code:

ActiveSheet.OLEObjects.Add
ClassType:="Forms.CommandButton.1", Link:=False _
, DisplayAsIcon:=False, Left:=171, Top:=51.75,
Width:=46.5, Height:= _
22.5).Select
With Selection
.Placement = xlMoveAndSize
.PrintObject = True
End With


The key line is:

selection.placement = xlMoveAndSize

David Fixemer





All times are GMT +1. The time now is 07:32 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com