Consulting

Results 1 to 6 of 6

Thread: User must fill in certain cells before they can close the workbook

  1. #1

    User must fill in certain cells before they can close the workbook

    Hi have been using the following artical (vbaexpress.com/kb/getarticle.php?kb_id=587) to to ensure that mandatory cells are completed, however I now have a need to protect a range of cells that are non editable within a sheet that the code applies. However, once protected I get an error. Can any one advise.

  2. #2
    VBAX Tutor
    Joined
    Mar 2014
    Posts
    210
    Location
    What is the error?

  3. #3
    Quote Originally Posted by ranman256 View Post
    What is the error?
    Thanks for getting back to me - Run time error "1004" Application defined or object defined-error.Schedule A Template X option 1 test.xlsm

  4. #4
    try like
                Cell.Parent.Unprotect pwd
                Cell.Interior.ColorIndex = 6 '** color yellow
                Cell.Parent.Protect pwd

  5. #5
    Quote Originally Posted by westconn1 View Post
    try like
                Cell.Parent.Unprotect pwd
                Cell.Interior.ColorIndex = 6 '** color yellow
                Cell.Parent.Protect pwd
    Thank for taking the time to help - I assume that pwd is the password applicable to the sheet.
    On repacing the sample section of the VBA this give me run time error 1004 and an advisory that I have a password mismatch - a debug highlights that the issue is within Cell.Parent.Unprotect pwd.

  6. #6
    password mismatch
    are you passing the password as a literal or variable?
    are you sure it is correct?
    it worked on testing
    cell.parent is the worksheet, so you could try the sheet object, but it should be the same thing

Tags for this Thread

Posting Permissions

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