In this tutorial, we will guide you on how to ** change the availability of the shortcut menus using VBA ** in Excel. Let’s get them below!! Get an official version of MS Excel from the following link: https://www.microsoft.com/en-in/microsoft-365/excel
Example
- Firstly, in the Excel Worksheet, you have to go to the Developer Tab.
- Then, you need to ** ** select the Visual Basic option under the Code section.
- Now, you have to copy and paste the code given below.
Sub ToggleCommandBars()
Dim cbEnabled As Boolean
cbEnabled = Not CommandBars(25).Enabled
CommandBars(25).Enabled = cbEnabled ' shortcutmenu for cells
CommandBars(26).Enabled = cbEnabled ' shortcutmenu for columns
CommandBars(27).Enabled = cbEnabled ' shortcutmenu for rows
CommandBars("Toolbar List").Enabled = cbEnabled ' shortcutmenu for toolbars
End Sub
- You need to save the code by selecting it and then close the window.
- Again, you have to go to the Excel Spreadsheet , and click on the Developer Tab.
- Then, you need to choose the Macros option in the Code section.
- Now, you have to make sure that your macro name is selected and click the *Run * button.
- Finally, after running the macro, you will get the output ** as **change the availability of the shortcut menus in Excel.
Closure
We hope that this tutorial gives you guidelines on how to change the availability of the shortcut menus using VBA in Excel. Please leave a comment in case of any queries, and don’t forget to mention your valuable suggestions as well. Thank you so much for Visiting Our Site!! Continue learning on Geek Excel!! *Read more on Excel Formulas *!!
Continue Reading:
- How To Pass arguments to macros from buttons and menus using VBA in Excel?
- Excel Formulas to Find the Same Date in Next Year ~ Simple Guide!!
- How to Change the Date Format in Excel Office 365? ~ Complete Guide!!
- Change the Time Format in Excel Office 365 ~ Useful Guide!!
- Excel Formulas to Get the Percent Change ~ Quick Method!!
Top comments (0)