+ Reply to Thread
Results 1 to 5 of 5

Display error message when inserting record on a locked cell

  1. #1
    Forum Contributor
    Join Date
    07-04-2018
    Location
    Dallas
    MS-Off Ver
    MS 365 Version 2302
    Posts
    209

    Display error message when inserting record on a locked cell

    Hello All,

    I have an excel which has a Insert macro to insert blank records in the selected row.

    Eg: At B11, I should give 2 to insert 2 blank records.

    This is working fine as expected. Now, I need to lock the Amount column in the sheet. When I lock it and run the macro. It throws an error.

    It is because, we cannot insert blank row on a sheet which has a column locked.

    Can anyone please suggest if I can display a message as ' Unlock the Amount' instead of the error in the file. This will help users to understand the reason of the error.

    Attached a sample file of the functionality. 'test' is the password to unlock the column.

    Any suggestions are much appreciated.

    Thanks in advance.
    Attached Files Attached Files

  2. #2
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: Display error message when inserting record on a locked cell

    Your macro could unprotect the sheet, insert the rows, then re-protect the sheet.

    Please Login or Register  to view this content.
    Surround your VBA code with CODE tags e.g.;
    [CODE]your VBA code here[/CODE]
    The # button in the forum editor will apply CODE tags around your selected text.

  3. #3
    Forum Contributor
    Join Date
    07-04-2018
    Location
    Dallas
    MS-Off Ver
    MS 365 Version 2302
    Posts
    209

    Re: Display error message when inserting record on a locked cell

    Thank you for the reply.

    My requirement is not to unprotect the sheet and insert. Rather it should inform users to unprotect the sheet.

    I have updated my excel, with another macro 'Update'.

    The sheet gets unprotected when clicking on 'Update' macro and I am able to insert record.

    But, what is happening is I still get message as 'Select update to insert records' which is the error message displayed and then records are getting inserted.

    When the sheet is unprotected, I need to have records inserted directly without the message displayed. Attaching the sheet.
    Attached Files Attached Files

  4. #4
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: Display error message when inserting record on a locked cell

    Please Login or Register  to view this content.

  5. #5
    Forum Contributor
    Join Date
    07-04-2018
    Location
    Dallas
    MS-Off Ver
    MS 365 Version 2302
    Posts
    209

    Re: Display error message when inserting record on a locked cell

    Thanks so much!! That works.

+ 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. [SOLVED] How to check adjacent cell for value and display error message for certain conditions
    By ScotyB in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 05-01-2017, 08:17 PM
  2. Display error message if cell has no value
    By callum91 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 11-20-2015, 10:40 AM
  3. If cell is empty and macro is pressed display error message.
    By karol2234 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-20-2012, 01:47 PM
  4. How can I make an error message display when a required cell is left blank?
    By saulmgf in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-04-2008, 03:45 PM
  5. Locked Sheet - Error msg to display to Users
    By Darin Kramer in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-29-2005, 05:06 PM
  6. How to display a blank cell with no error message
    By Juco in forum Excel Formulas & Functions
    Replies: 11
    Last Post: 01-31-2005, 05:06 AM
  7. Error message: Unable to record
    By Tim in forum Excel General
    Replies: 0
    Last Post: 01-26-2005, 03:25 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