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

Thread: Using VB to Lock Cells based on value in another cell

  1. #1
    Guest

    Default

    Is there a way to lock cells using VB based on the value of another cell. Example:

    IF A2 = A1 then
    Locked Cells C2 and D2 from data entry.

    Thanks.

  2. #2
    MrExcel MVP
    Join Date
    Feb 2002
    Location
    Bogota, Colombia
    Posts
    11,959
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Put this macro in the sheet's module.

    Private Sub Worksheet_Calculate()
    If [A2] = [A1] Then [C2:D2].Locked = True Else [C2:D2].Locked = False
    End Sub

    Regards,

    Juan Pablo González
    http://www.juanpg.com

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
  •