+ Reply to Thread
Results 1 to 3 of 3

Use sub for a column only

  1. #1
    Registered User
    Join Date
    04-16-2012
    Location
    india
    MS-Off Ver
    Excel 2007
    Posts
    33

    Use sub for a column only

    Private Sub Worksheet_Change(ByVal Target As Range)
    'Do nothing if more than one cell is changed or content deleted
    If Target.Cells.Count > 1 Or IsEmpty(Target) Then Exit Sub

    ActiveSheet.Unprotect "1234"
    For Each cel In Target
    If cel.Value <> "" Then
    cel.Locked = True
    End If
    Next cel
    ActiveSheet.Protect "1234"

    End Sub

    How to restrict above for particular column only?

  2. #2
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,327

    Re: Use sub for a column only

    Please take a few minutes to read the Forum Rules about using code tags and then amend your post accordingly.

    [ code ] At the beginning of the code >> (without the spaces)
    Code goes here
    [ /code ] At the end of the code >> (without the spaces)
    HTH
    Regards, Jeff

  3. #3
    Valued Forum Contributor StevenM's Avatar
    Join Date
    03-23-2008
    Location
    New Lenox, IL USA
    MS-Off Ver
    2007
    Posts
    910

    Re: Use sub for a column only

    Add the line:
    Please Login or Register  to view this content.
    Where "4" is the column number you need.

    Please Login or Register  to view this content.

+ 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