Make Button Visible. HELP PLEASE

Mister H

Well-known Member
Joined
Mar 6, 2002
Messages
1,507
:biggrin:Hi:

I know I have the answer to this somewhere but it eludes me at this time and the boss a is asking for a look at a spreadsheet but I can't get a Command Button to appear when a criteria is met. I get the message:<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p>
<o:p></o:p>
Method Select of Object Shape failed<o:p></o:p>
<o:p></o:p>
It is a CommandButton that I have renamed. It is currently invisible on the sheet titled Journal the criteria that I want is in a named range on a sheet titled Deposit Worksheet<o:p></o:p>
<o:p></o:p>
Here is the code:<o:p></o:p>
Code:
Sheets("Journal").Select
    
'If the range "EstreatedBail" on the Deposit Worksheet is <> 0 then show
'the button "EstreatedBailItemsButton"
 
    If Sheets("Deposit Worksheet").Range("EstreatedBail").Value <> 0 Then
    ActiveSheet.Shapes("EstreatedBailItemsButton").Select
    EstreatedBailItemsButton.Visible = True
    
Else
     End If

What am I doing wrong? :confused: I have tried a couple of things but no luck? Hopefully this is as simple as I :biggrin:

THANKS,
Mark
 

Excel Facts

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.
Method Select of Object Shape failed

I believe what it is trying to tell you is that you can't select something that is invisible. Most of the time you don't have to select cells or other objects to work with them. Please try the sample below (change in red).

Gary

Code:
Sheets("Journal").Select
    
'If the range "EstreatedBail" on the Deposit Worksheet is <> 0 then show
'the button "EstreatedBailItemsButton"
 
    If Sheets("Deposit Worksheet").Range("EstreatedBail").Value <> 0 Then
'    ActiveSheet.Shapes("EstreatedBailItemsButton").Select
'    EstreatedBailItemsButton.Visible = True

   [COLOR=Red] ActiveSheet.Shapes("EstreatedBailItemsButton").Visible = True[/COLOR]
    
Else
     End If
 
Upvote 0
Hi Gary:

THANKS for your input. It seems to be working now. I think another problem i was having as I was stepping through the code and I tyhink that casues and error when selecting buttons etc. I implemented your revision and closed excel and then ran the code using the button it was assigned to and all seems well :biggrin:

THANKS Again,
Take Care,
Mark
 
Upvote 0

Forum statistics

Threads
1,224,560
Messages
6,179,520
Members
452,922
Latest member
nstaab07

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