Thanks Thanks:  0
Likes Likes:  0
Results 1 to 2 of 2

Thread: MACRO.Help pls

  1. #1
    New Member
    Join Date
    Apr 2002
    Post Thanks / Like
    0 Post(s)
    0 Thread(s)


    i got a cell (A3) and there is a string inside. i dun want anybody to change it. If somebody try to change it, i want to prompt a message!how to do in excel macro.pls help

  2. #2
    MrExcel MVP Tom Urtis's Avatar
    Join Date
    Feb 2002
    San Francisco, California USA
    Post Thanks / Like
    1 Post(s)
    1 Thread(s)


    Since you are asking for a macro solution, here's one way. You should know that the VBA approach for cell protection is usually less effective than the standard cell-lock-and-sheet-protection method, because the code, unless very extensive (so why bother) allows changes to be made in formatting and spell check. You are better off with standard protection, but here's the code nonetheless. Right click on your sheet tab, left click on View Code, and paste this in:

    Private Sub Worksheet_Change(ByVal Target As Range)
    If Not Intersect(Target, Range("A3")) Is Nothing Then
    Application.EnableEvents = False
    MsgBox "Sorry, this cell is protected.", 16, "Access denied."
    Application.EnableEvents = True
    End If
    End Sub

Some videos you may like

User Tag List

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

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