Results 1 to 2 of 2

Thread: Help- Locking column basis current date.

  1. #1
    Member
    Join Date
    Aug 2011
    Posts
    92
    Rep Power
    14

    Help- Locking column basis current date.

    Hi,

    Need help in an employee attendance sheet.

    The macro should help in following:

    1- Should allow to change the attendance for previous and current day. Befor that column should be locked.
    2-The attendance cells should not be left blank for a day (attendance should be filled for all active employee, apart from the employee who resigned). This can be verified while saving the sheet.

    Attached is the sample file.
    Attendance.xlsx

    Requesting assistance.

    Thanks
    Rajesh

  2. #2
    Member
    Join Date
    Aug 2011
    Posts
    92
    Rep Power
    14
    Hi ,
    This macro solved point # 1

    HTML Code:
    Sub lockclmn()
    
    Dim cell As Range
    Dim Range As Range
    Set rng1 = Worksheets("Sheet1").Range("C1:O1")
    ActiveSheet.Unprotect Password:="test"
     
    For Each cell In rng1.Cells
    If cell.Value2 < CLng(Date) - 1 Then
    cell.EntireColumn.Locked = True
    Else
     cell.EntireColumn.Locked = False
    End If
    Next
    ActiveSheet.Protect Password:="test"
    
    End Sub
    Help is needed in poin#2.

    Thanks
    Rajesh

Similar Threads

  1. Replies: 5
    Last Post: 06-15-2013, 12:40 PM
  2. Locking Columns data to be edited.
    By acsinha in forum Excel Help
    Replies: 1
    Last Post: 04-11-2013, 10:33 AM
  3. High Lighting Current Date In employee Attendance
    By sanjeevi888 in forum Excel Help
    Replies: 2
    Last Post: 07-01-2012, 10:59 PM
  4. Visual Plotter basis given dates and activity
    By Rajesh Kr Joshi in forum Excel Help
    Replies: 2
    Last Post: 03-07-2012, 02:37 PM
  5. Lock cells on the basis of date VBA
    By Rajesh Kr Joshi in forum Excel Help
    Replies: 22
    Last Post: 09-27-2011, 03:56 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
  •