+ Reply to Thread
Results 1 to 6 of 6

Prevent inserting column by user

  1. #1
    Registered User
    Join Date
    01-11-2010
    Location
    Singapore
    MS-Off Ver
    Excel 2003
    Posts
    9

    Prevent inserting column by user

    I have protected the sheet with password. But I need to protect/prevent first 10 columns ( A:J) being deleted or inserted with new column by user. Looking for vb code.
    Thanks in advance.

  2. #2
    Valued Forum Contributor abduljaleel.mca's Avatar
    Join Date
    02-13-2013
    Location
    Chennai, India
    MS-Off Ver
    MS 365 Business
    Posts
    326

    Re: Prevent inserting column by user

    Follow these steps,

    1. Go to the Visual Basic Editor by pressing the keys Alt+F11.

    2. From the Project Explorer, double-click over the ThisWorkbook object

    3. That will execute an event window for you. At the top of the new code window, you will see the word 'General'. Select the drop down where you see general and select 'Workbook'.

    4. You will notice that Excel VBA assumes the Open event. That means whatever code you insert in this procedure will execute automatically when the workbook is opened.


    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    01-11-2010
    Location
    Singapore
    MS-Off Ver
    Excel 2003
    Posts
    9
    Quote Originally Posted by abduljaleel.mca View Post
    Follow these steps,

    1. Go to the Visual Basic Editor by pressing the keys Alt+F11.

    2. From the Project Explorer, double-click over the ThisWorkbook object

    3. That will execute an event window for you. At the top of the new code window, you will see the word 'General'. Select the drop down where you see general and select 'Workbook'.

    4. You will notice that Excel VBA assumes the Open event. That means whatever code you insert in this procedure will execute automatically when the workbook is opened.


    Please Login or Register  to view this content.
    Hi Abdul,
    It does not work the way I wanted. 1). It's block all columns from inserting 2) once unprotected user can still can insert
    3) runtime error 1004 when reopen.

  4. #4
    Valued Forum Contributor abduljaleel.mca's Avatar
    Join Date
    02-13-2013
    Location
    Chennai, India
    MS-Off Ver
    MS 365 Business
    Posts
    326

    Re: Prevent inserting column by user

    Keep the above code as it is. Additionally,
    Right click on the your working sheet and select 'View code' and paste the below one.
    Please Login or Register  to view this content.
    Last edited by abduljaleel.mca; 08-04-2016 at 08:07 AM.

  5. #5
    Registered User
    Join Date
    01-11-2010
    Location
    Singapore
    MS-Off Ver
    Excel 2003
    Posts
    9

    Re: Prevent inserting column by user

    Jaleel,
    Some how we are sync. see attached
    Prevent Insert Column.jpg

  6. #6
    Valued Forum Contributor abduljaleel.mca's Avatar
    Join Date
    02-13-2013
    Location
    Chennai, India
    MS-Off Ver
    MS 365 Business
    Posts
    326

    Re: Prevent inserting column by user

    Siva,
    It works perfectly for me here.
    I don't understand your point. Please elaborate. Also you could attach a sample workbook to demonstrate your need or problem facing. Make sure your desired results are shown. Remember to desensitize the data.
    Click on GO ADVANCED and then scroll down to Manage Attachments to open the upload window.
    Last edited by abduljaleel.mca; 08-04-2016 at 10:42 AM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. How to prevent user to enter serial number in column B manually
    By mso3 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 09-27-2015, 09:50 AM
  2. VBA prevent inserting a row when row 1 is the row above
    By gwd in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-09-2014, 03:04 AM
  3. prevent Excel from adjusting formulas when inserting new columns of raw data
    By fmxwannabe in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 11-12-2013, 01:16 AM
  4. Replies: 1
    Last Post: 07-22-2013, 07:58 PM
  5. Prevent User Enter Duplicates in Column
    By jade82 in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 03-22-2011, 10:48 PM
  6. How to prevent the user to update the user defined style
    By nnram123 in forum Word Formatting & General
    Replies: 0
    Last Post: 07-27-2010, 01:52 AM
  7. Prevent user from inserting rows/cells
    By rhani111 in forum Excel General
    Replies: 4
    Last Post: 07-22-2007, 08:54 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1