Disable Insert & Delete Column

aayaanmayank

Board Regular
Joined
Jul 20, 2018
Messages
157
Hi Can any one help me on this. i need a code which can stop the user to delete or Insert the column from all the ways including Ribbon.

I am using below code but its not working on EXCEL RIBBON.
VBA Code:
Sub disControls()
Application.CommandBars("Ply").FindControl(ID:=847).Enabled = False
On Error Resume Next
With Application
With .CommandBars("Worksheet Menu Bar")
.Controls("Insert").Controls("Columns").Enabled = False
End With

With .CommandBars("Ply")
.Controls("Delete").Enabled = False
.Controls("Rename").Enabled = False
End With

With .CommandBars("Standard")
.Controls("Columns").Enabled = False
End With
End With

End Sub
 
Sure, i will try this way. Thanks alot for taking out time and help me on this.
Q Did it work for you?

Can you help me on how to select a picture which is in excel ?
every time that picture gets change so i have to select picture with dynamic name.
It is a different topic - so start a new thread
It needs a better explanation - how is the correct picture identified?
message me the link if you want
 
Upvote 0

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.
Did the solution in post#8 achieve what you wanted?
 
Upvote 0
I am amazed by your reply :eek:
- I explained in earlier post that =TODAY() can be placed in any cell
- there are only 4 things to be done
- perhaps I have confused you somewhere :oops:

SIMPLE INSTRUCTIONS
Choose a cell to the right of your data (in code below it is BB1 )
In that cell enter formula =TODAY()
Name that cell MyRange
Add the code and replace BB1 with the correct cell reference for the named range
Rich (BB code):
Private Sub Worksheet_Calculate()
    Dim Ref As String
    Const Monitored As String = "BB1"
    Ref = Replace(Split(ThisWorkbook.Names("myRange").RefersTo, "!")(1), "$", "")
    If Not Monitored = Ref Then Application.Undo
End Sub
 
Upvote 0

Forum statistics

Threads
1,215,679
Messages
6,126,182
Members
449,296
Latest member
tinneytwin

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