run time error 1004

khatri milan

New Member
Joined
Nov 6, 2019
Messages
17
i have a control button named "button 61" and a macro is assigned to it, within that macro there is a code : Worksheets("4_Lift Plan").OptionButtons("Button 61").Visible = False which esentially tells to make this same button invisible if certain condition is met and when i run it there is error 1004. Is it wrong to make buttn invisible from within its own code.
 

Excel Facts

Formula for Yesterday
Name Manager, New Name. Yesterday =TODAY()-1. OK. Then, use =YESTERDAY in any cell. Tomorrow could be =TODAY()+1.
Try this:
Code:
Worksheets("4_Lift Plan").OptionButtons("Option Button 61").Visible = False
 
Upvote 0
How about:

Code:
Worksheets("4_Lift Plan").[COLOR=#0000ff]DrawingObjects[/COLOR]("Button 61").Visible = False
 
Upvote 0
i have a control button named "button 61" and a macro is assigned to it, within that macro there is a code : Worksheets("4_Lift Plan").OptionButtons("Button 61").Visible = False which esentially tells to make this same button invisible if certain condition is met and when i run it there is error 1004. Is it wrong to make buttn invisible from within its own code.


In your code your are referring to an Excel Form Control OptionButton when from what you describe, you really mean Buttons which would explain the error.

try this update

Code:
Worksheets("4_Lift Plan").Buttons("Button 61").Visible = False

Dave
 
Upvote 0
Alternatively
Code:
Worksheets("4_Lift Plan").Shapes("Button 61").Visible = False
 
Last edited:
Upvote 0
Code:
Worksheets("4_Lift Plan").Buttons("Button 61").Visible = False

Dave


Hi Dave, that alternative does not work for me.

If the button is an Active X Control, this would be another alternative:

Code:
Worksheets("4_Lift Plan").OLEObjects("Button 61").Visible = True
 
Upvote 0
Hi Dave, that alternative does not work for me.

If the button is an Active X Control, this would be another alternative:

Code:
Worksheets("4_Lift Plan").OLEObjects("Button 61").Visible = True

Dante

In my post I clearly stated

In your code your are referring to an Excel Form Control

code works fine for me with a Form Control Button - I just amended posted code for the OP to try.

It maybe for you that your system may need to use the Controls msoTriState enumeration. msoFalse

Dave
 
Last edited:
Upvote 0
Dante

In my post I clearly stated
code works fine for me with a Form Control Button - I just amended posted code for the OP to try.
It maybe for you that your system may need to use the Controls msoTriState enumeration. msoFalse
Dave

Sorry, iIt doesn't work for me for a Form Control Button either, I hope, this works for the OP (it's important)
 
Upvote 0
Not sure why it doesn't work for you, as it works for me, as long as the object is a button, rather than an option button.
 
Upvote 0
:rofl: I had the idea that it was an optionbutton, because the OP thus put its instruction. Thanks @Fluff for clarifying it

An apology @dmt32 :banghead: it also works for me for a button.
 
Upvote 0

Forum statistics

Threads
1,223,236
Messages
6,170,906
Members
452,366
Latest member
TePunaBloke

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