1 min readfrom Microsoft Excel | Help & Support with your Formula, Macro, and VBA problems | A Reddit Community

Enabling or Hide "Delete" option on right click

Hello,

How I can enabled or hide "delete" option on few selected sheets.

So what I have tried is to put this to VBA on selected sheet workbook
Application.CommandBars("Ply").Controls("Delete").Enabled = True or even tried it with False

and nothing happen.

What I understood if tried using this on old excel version except "Ply" would be "Cell...", it wouldve work. But in current new one wont work.

I have asked chatgpt, looked up youtube tutorials and nothing help.
I have also tried this to thisWorkBook and still nothing happen. Can someone help me thx.

Private Sub Workbook_SheetActivate(ByVal Sh As Object) On Error Resume Next Select Case Sh.CodeName Case "Sheet27", "Sheet28", "Sheet29", "Sheet30", "Sheet32" Application.CommandBars("Ply").Controls("Delete").Enabled = False Application.CommandBars("Ply").Controls("Delete...").Enabled = False Case Else Application.CommandBars("Ply").Controls("Delete").Enabled = True Application.CommandBars("Ply").Controls("Delete...").Enabled = True End Select End Sub 
submitted by /u/benyzland
[link] [comments]

Want to read more?

Check out the full article on the original site

View original article

Tagged with

#Excel compatibility
#Excel alternatives for data analysis
#Excel alternatives
#rows.com
#google sheets
#financial modeling with spreadsheets
#no-code spreadsheet solutions
#delete
#Excel
#VBA
#Enabled
#Application.CommandBars
#selected
#sheets
#Workbook_SheetActivate
#CodeName
#thisWorkBook
#old excel version
#controls
#On Error Resume Next