Disable Cells

  • I'm new to the VBA coding, could you please let me know how can we
    disable/enable a cell based on a condition which is dependent on other cell data

    Thanks & Regards,
    Ali

  • Re: Disable Cells


    You can set the locked condition of the cell depending on the value or condition of other cells as follows ( for example )

    Code
    Range("D8").Select' or whatever the range is
    if Range(""E1")>0 Then' or whatever your condition needs to be
    Selection.Locked = True
    End If

    "The light that burns twice as bright burns for half as long "

  • Re: Disable Cells


    i tried doing this i got an error. My requirement is my worksheet is protected
    with few cells editable. Now based on the one of the data of editable cell I need to protect other cells to be entered.

    Thanks & Regards,
    Ali

  • Re: Disable Cells


    If you're spreadsheet is protected then you'll need to add this to the code


    Code
    ActiveSheet.Protect UserInterfaceOnly:=True


    This will allow the macro to effectively ignore sheet protection.


    HTH

    "The light that burns twice as bright burns for half as long "

  • Re: Disable Cells


    You can also try this code here:



    This code should unlock cell A2 when you type in A1. Just remember to have cell A1 unlocked.
    Alring

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!