Disable Insert & Delete Column

aayaanmayank

Board Regular
Joined
Jul 20, 2018
Messages
156
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
 

Yongle

Well-known Member
Joined
Mar 11, 2015
Messages
6,977
Office Version
  1. 365
Platform
  1. Windows
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
 

Excel Facts

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".

Yongle

Well-known Member
Joined
Mar 11, 2015
Messages
6,977
Office Version
  1. 365
Platform
  1. Windows
Did the solution in post#8 achieve what you wanted?
 

Yongle

Well-known Member
Joined
Mar 11, 2015
Messages
6,977
Office Version
  1. 365
Platform
  1. Windows
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
 
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,152,125
Messages
5,768,250
Members
425,460
Latest member
Astros1243

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
Top