Page 3 of 3 FirstFirst 123
Results 21 to 23 of 23

Thread: Lock cells on the basis of date VBA

  1. #21
    Member
    Join Date
    Aug 2011
    Posts
    92
    Rep Power
    14
    Hi, This code is working fine, but when a user open the file its gives a dbug window with error: "Unable to Set the range property of the range class" and when i click dbug it highlights the below line:
    wksTarget.Cells.Locked = True

    This happend when I added few more sheets and password protect them, but havnt changed anything in the code, because the code should only work for 1 sheet (that is my sheet1). Seems the code is also looking for other sheets, buut i have already mentioned the wkstraget as sheet1.

    Thanks
    Rajesh
    Last edited by Rajesh Kr Joshi; 09-27-2011 at 01:43 AM.

  2. #22
    Administrator Admin's Avatar
    Join Date
    Mar 2011
    Posts
    1,123
    Rep Power
    10
    Hi,

    Will look this in detail later. In the meantime, add the following line before the debug line.
    Code:
    wksTarget.Unprotect Password:=Pwd
    Cheers !

    Excel Range to BBCode Table
    Use Social Networking Tools If You Like the Answers !

    Message to Cross Posters

    @ Home - Office 2010/2013/2016 on Win 10 (64 bit); @ Work - Office 2016 on Win 10 (64 bit)

  3. #23
    Member
    Join Date
    Aug 2011
    Posts
    92
    Rep Power
    14
    Thanks , it worked

Similar Threads

  1. Lock Cells After Data Entered
    By Admin in forum Excel and VBA Tips and Tricks
    Replies: 4
    Last Post: 06-28-2013, 10:52 PM
  2. Help- Locking column basis current date.
    By Rajesh Kr Joshi in forum Excel Help
    Replies: 1
    Last Post: 03-25-2013, 04:44 PM
  3. automatic Add date in cells
    By Ryan_Bernal in forum Excel Help
    Replies: 1
    Last Post: 01-23-2013, 02:50 PM
  4. How to Lock or Unlock row basis previous cell input?
    By Rajesh Kr Joshi in forum Excel Help
    Replies: 2
    Last Post: 07-25-2012, 02:40 PM
  5. Count no of cells containing date
    By princ_wns in forum Excel Help
    Replies: 5
    Last Post: 04-16-2012, 10:37 PM

Posting Permissions

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