CommandButtons not working.

riedyp

Board Regular
Joined
Feb 13, 2020
Messages
88
Office Version
  1. 365
Platform
  1. Windows
Hello,

I have a Navigation tab in a workbook that has buttons to take you to specific sheets.
I have written code so that when the "Plastics" option button is selected columns I:Q are hidden and all buttons within those rows are hidden.
VBA Code:
Private Sub OptionButton2_Click() '''''''Plastics
ActiveSheet.Shapes("CommandButton1").Visible = True
ActiveSheet.Shapes("CommandButton2").Visible = True
ActiveSheet.Shapes("CommandButton3").Visible = True
ActiveSheet.Shapes("CommandButton4").Visible = True
ActiveSheet.Shapes("CommandButton5").Visible = True
ActiveSheet.Shapes("CommandButton6").Visible = True
ActiveSheet.Shapes("CommandButton7").Visible = True
ActiveSheet.Shapes("CommandButton8").Visible = True
ActiveSheet.Shapes("CommandButton9").Visible = True
ActiveSheet.Shapes("CommandButton10").Visible = True
ActiveSheet.Shapes("CommandButton11").Visible = True

ActiveSheet.Shapes("CommandButton12").Visible = False
ActiveSheet.Shapes("CommandButton13").Visible = False
ActiveSheet.Shapes("CommandButton14").Visible = False
ActiveSheet.Shapes("CommandButton15").Visible = False
ActiveSheet.Shapes("CommandButton16").Visible = False
ActiveSheet.Shapes("CommandButton18").Visible = False
ActiveSheet.Shapes("CommandButton19").Visible = False
ActiveSheet.Shapes("CommandButton20").Visible = False
ActiveSheet.Shapes("CommandButton21").Visible = False
ActiveSheet.Shapes("CommandButton22").Visible = False

ActiveSheet.Shapes("CommandButton17").Visible = False
ActiveSheet.Shapes("CommandButton23").Visible = False
ActiveSheet.Shapes("CommandButton24").Visible = False
ActiveSheet.Shapes("CommandButton25").Visible = False
ActiveSheet.Shapes("CommandButton26").Visible = False
ActiveSheet.Shapes("CommandButton32").Visible = False
ActiveSheet.Shapes("CommandButton27").Visible = False
ActiveSheet.Shapes("CommandButton28").Visible = False
ActiveSheet.Shapes("CommandButton29").Visible = False
ActiveSheet.Shapes("CommandButton30").Visible = False
ActiveSheet.Shapes("CommandButton31").Visible = False
ActiveSheet.Shapes("CommandButton32").Visible = False
ActiveSheet.Shapes("CommandButton33").Visible = False
ActiveSheet.Shapes("CommandButton34").Visible = False

ActiveSheet.Shapes("CommandButton35").Visible = False
ActiveSheet.Shapes("CommandButton36").Visible = False
ActiveSheet.Shapes("CommandButton37").Visible = False
ActiveSheet.Shapes("CommandButton38").Visible = False
ActiveSheet.Shapes("CommandButton39").Visible = False
ActiveSheet.Shapes("CommandButton40").Visible = False
ActiveSheet.Shapes("CommandButton42").Visible = False
ActiveSheet.Shapes("CommandButton43").Visible = False
ActiveSheet.Shapes("CommandButton44").Visible = False
ActiveSheet.Shapes("CommandButton45").Visible = False
ActiveSheet.Shapes("CommandButton46").Visible = False
ActiveSheet.Shapes("CommandButton47").Visible = False

Columns("I:Q").Hidden = True
Columns("F:H").Hidden = False
ActiveSheet.Shapes("Group Box 110").Visible = False
End Sub

All other of the Option buttons have similar code. They collapse columns and hide buttons in those specific rows. Leaving one color set of buttons "unhidden" and the two sets of Gray buttons "unhidden".
All of the hiding and unhiding of columns and buttons works.
But all of a sudden the only CommandButtons that are working are the:
- Gray Command Buttons
-Pink "Gen Design Requirements" & "Material Requirements" CommandButtons.

If I click the other buttons a button appears under "educational" as you can see from the image.
When I reopen the file all of the colored buttons appear in that "educational" column stacked on top of each other.

Please let me know if you have any theories to help. I appreciate any efforts!
 

Attachments

  • allbuttonss.PNG
    allbuttonss.PNG
    46.4 KB · Views: 21
  • IMG_2108 (1).jpg
    IMG_2108 (1).jpg
    36.7 KB · Views: 22

Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.

Forum statistics

Threads
1,223,888
Messages
6,175,219
Members
452,620
Latest member
dsubash

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