+ Reply to Thread
Results 1 to 3 of 3

Prevent row deletion and cell modification

  1. #1
    Registered User
    Join Date
    07-23-2013
    Location
    melbourne
    MS-Off Ver
    Excel 2007
    Posts
    8

    Prevent row deletion and cell modification

    Hi
    I have been trying to use the following macros in a unprotected worksheet to enable me to prevent users from modifying the cells:

    Private Sub Worksheet_Change(ByVal Target As Excel.Range)
    If Intersect(Target, Range("X15:Z22")) Is Nothing Then Exit Sub
    Application.EnableEvents = False
    MsgBox "Hey, leave me alone!", 48, "Sorry, I'm protected."
    Application.Undo
    Application.EnableEvents = True
    End Sub

    Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range)
    If ActiveCell.HasFormula Then
    MsgBox ("Formula in cell do not remove or change!")
    Else
    End If
    End Sub

    The issue i have is that this doesn't stop the user from deleting rows. I tried using protect worksheet function to overcome having to use macros all together but delete row ends up being disabled

    Can anyone help or help me to modify these macros in some way to prevent row deletion?

  2. #2
    Forum Expert Fotis1991's Avatar
    Join Date
    10-11-2011
    Location
    Athens(The homeland of the Democracy!). Greece
    MS-Off Ver
    Excel 1997!&2003 & 2007&2010
    Posts
    13,744

    Re: Prevent row deletion and cell modification

    Welcome to the forum.

    We'd like to help you but first.

    Pls take some minutes to read forum rules and specially-in this case- rule#3
    Regards

    Fotis.

    -This is my Greek whisper to Europe.

    --Remember, saying thanks only takes a second or two. Click the little star * below, to give some Rep if you think an answer deserves it.

    Advanced Excel Techniques: http://excelxor.com/

    --KISS(Keep it simple Stupid)

    --Bring them back.

    ---See about Acropolis of Athens.

    --Visit Greece.

  3. #3
    Registered User
    Join Date
    07-23-2013
    Location
    melbourne
    MS-Off Ver
    Excel 2007
    Posts
    8

    Re: Prevent row deletion and cell modification

    sorry about that :-)

    Please Login or Register  to view this content.
    Please Login or Register  to view this content.

+ 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. Replies: 20
    Last Post: 04-01-2020, 11:04 PM
  2. [SOLVED] Require Cell To Contain Minimum Of '1' And Prevent Deletion
    By swordswinger710 in forum Excel Programming / VBA / Macros
    Replies: 16
    Last Post: 06-07-2012, 12:07 PM
  3. prevent cell values modification after saving the worksheet.
    By bittu2010 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 01-09-2012, 03:12 AM
  4. Prevent deletion of cell content after writing
    By careso in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-11-2009, 03:44 PM
  5. Prevent deletion of a cell with no cell protection
    By jman0707 in forum Excel Formulas & Functions
    Replies: 15
    Last Post: 10-31-2008, 09:58 AM

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