+ Reply to Thread
Results 1 to 8 of 8

Locking non blank cells in range

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    07-12-2005
    Posts
    143

    Locking non blank cells in range

    Hi all,

    I have a worksheet where columns A:C are locked and the sheet password protected. The user enters info into cells in columns D and E (unlocked). The cells in columns D and E are blank but may have a validation list attached.

    Now when the user hits a "process" button, part of my script will be to lock any cells in columns D and E that are no longer blank, therefore stopping overwriting of cells at a later date. I know how to password unprotect and protect using VB, but i'm not sure of the script for locking cells that are no longer blank in a range (column D:E).

    Any help would be much appreciated, as always on this site!

    Thanks in advance.

    Chris

  2. #2
    Forum Contributor
    Join Date
    12-12-2005
    Posts
    667
    Range("C4:C6").Select
    Selection.Locked = True
    Best regards,

    Ray

  3. #3
    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
    Hi,

    Just record the action.

    Select Columns > press F5 > tick constants.

    The record macro should give you this line

    Selection.SpecialCells(xlCellTypeConstants, 23).Select
    The rest should be easy

    VBA Noob
    _________________________________________


    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 !!!

  4. #4
    Forum Contributor
    Join Date
    07-12-2005
    Posts
    143
    Thanks for the quick replies guys. I can't use your method raypayette because the cells that are non blank will be randomly dispersed through the column. Plus the user shouldn't be deciding what area to lock, that has to be determined on his/her entries.

    I tried the F5 method Noob but it just gave me "Go To" - I'm not super good at VB so am i missing something?

    Thanks.
    Chris

  5. #5
    Forum Contributor
    Join Date
    07-12-2005
    Posts
    143
    I think i should have explained myself a bit better - i'm crap at explaining stuff.

    Basically i need script to turn non-blank cells in columns D and E to locked.

    That was better

  6. #6
    Forum Contributor
    Join Date
    08-20-2005
    Posts
    173
    Hi,

    Using The F5 method:

    click on F5, bottom left of the caption which appears you will see "Special...",
    click on this and then choose "constants"

    TDV

  7. #7
    Forum Contributor
    Join Date
    07-12-2005
    Posts
    143
    Yep - definately a whack with the thickie stick. Had the sheet protected so didn't notice the special tab after pressing F5

    Thanks for the help all.

    Chris

+ Reply to 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