+ Reply to Thread
Results 1 to 5 of 5

locking column a only

  1. #1
    Registered User
    Join Date
    06-07-2008
    Location
    philippines
    Posts
    10

    locking column a only

    i am using this vba code:
    Private Sub Worksheet_Change(ByVal Target As Range)
    If Not Intersect(Target, Range("B:B")) Is Nothing Then
    Application.EnableEvents = False
    Cells(Target.Row, 1) = Now
    End If
    Application.EnableEvents = True
    End Sub
    everytime i lock the column a by using the protect sheet, the vba does not work or debugs.

    is there a way for me to lock the cell in column a when data is inputted or changed in column b?

    i am using date and time for column a
    Attached Files Attached Files
    Last edited by zarathos; 12-11-2008 at 10:14 AM.
    excel geek - trying to be

  2. #2
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,480
    http://office.microsoft.com/en-us/ex...CL100570551033
    Basically, you need to unlock the cells you want to edit before protecting the sheet.

  3. #3
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    First of all unlock all the cells from the Format menu -> Cells -> Protection & uncheck Locked.

    Then select all the cells that currently need to be locked, eg A2:A351and lock them using the same method as above but checking Locked this time.

    Then change your code with this

    Please Login or Register  to view this content.
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  4. #4
    Valued Forum Contributor rwgrietveld's Avatar
    Join Date
    09-02-2008
    Location
    Netherlands
    MS-Off Ver
    XL 2007 / XL 2010
    Posts
    1,671
    Try to put these lines in
    Please Login or Register  to view this content.
    Looking for great solutions but hate waiting?
    Seach this Forum through Google

    www.Google.com
    (e.g. +multiple +IF site:excelforum.com/excel-general/ )

    www.Google.com
    (e.g. +fill +combobox site:excelforum.com/excel-programming/ )

    Ave,
    Ricardo

  5. #5
    Registered User
    Join Date
    06-07-2008
    Location
    philippines
    Posts
    10
    it worked for wonderfully my own drive.

    but is showing error when i put it in a shared drive.

    could it be that i did something wrong?

    Please Login or Register  to view this content.
    Last edited by zarathos; 12-11-2008 at 11:44 AM.

+ 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