I have 41 command buttons on the main worksheet in my workbook. Whenever one of these command buttons are 'clicked', it first sets the bold attribute for all of the buttons to 'False'. Next it executes it's specific action (which is filtering or sorting data that is on that page) and then it changes the font in the specific command button that was just clicked to TRUE. This is done so that the user is able to identify which command button (because there are many) is currently selected (which would be the only one that is now BOLD.) Whenever a different command button is clicked, it first re-sets ALL the other command buttons to regular.
This is where I am trying to simplify my current code. Currently, my code sets the bold property for all 41 command buttons individually (which takes up A LOT of space for all of the command buttons):
So there is A LOT of code that I am (hoping) isnt necessary in order to achieve the desired effect I am after (setting the bold attribute to FALSE for all the command buttons on the worksheet.) Is there a way to do this?
Thank you for any help
Keith
This is where I am trying to simplify my current code. Currently, my code sets the bold property for all 41 command buttons individually (which takes up A LOT of space for all of the command buttons):
Code:
' REMOVE ALL FORMATTING FROM THE COMMANDBUTTONS IN EXCEPT FOR THE CURRENT BUTTON THAT WAS JUST CLICKED: (cmdPackaging)
' CURRENT COMMANDBUTTON SELECTED:
cmdPackaging.Font.Bold = True
' UNFORMAT ALL OTHER DEPARTMENT COMMANDBUTTONS
cmdPack12.Font.Bold = False
cmdPack35.Font.Bold = False
cmdMilling.Font.Bold = False
cmdBlendAll.Font.Bold = False
cmdBlending.Font.Bold = False
cmdFlammableBlend.Font.Bold = False
cmdLabels.Font.Bold = False
cmdPowderAll.Font.Bold = False
cmdPowders.Font.Bold = False
cmdPolymers.Font.Bold = False
cmdMaintenance.Font.Bold = False
cmdAgAll.Font.Bold = False
cmdAgBlending.Font.Bold = False
cmdAgPackaging.Font.Bold = False
cmdLab.Font.Bold = False
cmdShipAll = False
cmdShipping.Font.Bold = False
cmdWarehouse.Font.Bold = False
cmdSupervisors.Font.Bold = False
cmdTollAll.Font.Bold = False
cmdToll.Font.Bold = False
cmdBuilding8.Font.Bold = False
cmdOilField.Font.Bold = False
cmdCustomerService.Font.Bold = False
cmdSales.Font.Bold = False
cmdQMS.Font.Bold = False
cmdHR.Font.Bold = False
cmdPurchasing.Font.Bold = False
cmdScheduling.Font.Bold = False
cmdAccounting.Font.Bold = False
cmdEHS.Font.Bold = False
' UNFORMAT ALL COMMANDBUTTONS FOR SUPERVISORS:
cmdCha.Font.Bold = False
cmdJUS.Font.Bold = False
cmdEDD.Font.Bold = False
cmdDAN.Font.Bold = False
cmdMIK.Font.Bold = False
cmdCOD.Font.Bold = False
cmdEHS.Font.Bold = False
' UNFORMAT ALL REMAINING COMMANDBUTTONS ON WORKSHEET:
cmdSalary.Font.Bold = False
cmdSalary.Font.Italic = False
cmdSalary.Font.Underline = False
cmdSalary.BackColor = &H8000000F
cmdHourly.BackColor = &H8000000F
cmdHourly.Font.Bold = False
cmdHourly.Font.Italic = False
cmdHourly.Font.Underline = False
So there is A LOT of code that I am (hoping) isnt necessary in order to achieve the desired effect I am after (setting the bold attribute to FALSE for all the command buttons on the worksheet.) Is there a way to do this?
Thank you for any help
Keith