Commandbutton size=false?

Guanjin Peter

Active Member
Joined
May 21, 2008
Messages
429
Hi I'm facing a little problem here. WHenever I select a list from the combobox, it autosizes the columns and rows. Thus it also affects the sizes of the command button and move it out of place.
Is there a command to force the commnad button not to move or resize?
 

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"
Design mode -> Control button -> Rightclick -> Format Control -> Properties -> Don't move or size with cells.
 
Upvote 0
found another alternative is to create the buttons manually on new load, delete on exit.

the below compiles with error. any idea?

Private Sub CommandButton1_Click()
ActiveSheet.OLEObjects.Add(ClassType:="Forms.CommandButton.1", Link:=False, DisplayAsIcon:=False, Left:=441, Top:=10.5, Width:=130.5, Height:=23.25) = True
End Sub
 
Upvote 0
Hi,

try:

Code:
Sub Test()
    Dim objOLEObject As OLEObject
    Set objOLEObject = ActiveSheet.OLEObjects.Add(ClassType:= _
        "Forms.CommandButton.1", Left:=441, Top:=10.5, _
        Width:=130.5, Height:=23.25)
End Sub
Case_Germany
 
Upvote 0

Forum statistics

Threads
1,214,646
Messages
6,120,718
Members
448,986
Latest member
andreguerra

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top