Closed Thread
Results 1 to 7 of 7

Conditional formatting maybe

Hybrid View

  1. #1
    Registered User
    Join Date
    09-27-2007
    Posts
    14

    Conditional formatting maybe

    does anyone know how I can lock or unlock a cell based on a condition of another cell?

  2. #2
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    This event macro lets you edit B1 if A1 equals yes

    See what you think

    VBA Noob
    Attached Files Attached Files
    _________________________________________


    Credo Elvem ipsum etian vivere
    _________________________________________
    A message for cross posters

    Please remember to wrap code.

    Forum Rules

    Please add to your signature if you found this link helpful. Excel links !!!

  3. #3
    Forum Contributor
    Join Date
    03-24-2005
    Location
    Wisconsin
    MS-Off Ver
    2007
    Posts
    378

    Will need to be VBA

    What "Kind" of condition are you talking about?

    Use the Worksheet_Change event
       IF 'Your code for the condition to be met' THEN
                ActiveCell.Locked = False
       END IF
    
       IF NOT 'Your condition to be met'  THEN  
               ActiveCell.Locked = True
       END IF
    Or substitute
    Range(myCell).Locked = TRUE
    Range(myCell).Locked = FALSE
    if you want to lock (or unlock) a cell that is not the active cell.
    Thanks!
    Dennis

    I am using Windows 7 and Office 2007, all of my posts are based on this.

  4. #4
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    or

    Change B1 to your range.
    and change Named range RestritiveRange to your cell or range


    Private Sub Worksheet_Change(ByVal Target As Range)
    With ActiveSheet
            If Range("B1").Value = True Then
                .UsedRange.Cells.Locked = False
                .Range("RestritiveRange").Locked = True
                .Protect Password:="Secret"
            Else
                .Unprotect Password:="Secret"
            End If
        End With
    End Sub
    VBA Noob

  5. #5
    Registered User
    Join Date
    09-27-2007
    Posts
    14
    I should have added that I want to do this without a macro

  6. #6
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    So why post under programming ??
    Have you not read the rules below ??

    VBA Noob

  7. #7
    Registered User
    Join Date
    09-27-2007
    Posts
    14
    Well - maybe an equation + conditional formatting???
    My situation would be a piece of cake if conditional formatting would allow a cell to be lock or unlocked base on a condition

Closed Thread

Thread Information

Users Browsing this Thread

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

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