+ Reply to Thread
Results 1 to 6 of 6

Lock cell(s) after data input using macro.

  1. #1
    Registered User
    Join Date
    01-22-2013
    Location
    Utrecht, The Netherlands
    MS-Off Ver
    Excel 2010
    Posts
    14

    Lock cell(s) after data input using macro.

    Hello everyone,

    Currently I am working on a excel sheet with macro's. If I choose 'NL' in D8 I want H8:J8 locked and if it is other than 'NL' H8:J8 will be unlocked.
    I am using the following code:

    Formula: copy to clipboard
    Please Login or Register  to view this content.
    I don't know what i did wrong but somehow it gives me a error 13 message that makes the following sentence yellow: If Target <> Range("D8") Then Exit Sub

    Is it possible to make the range D8:D200?
    Also, I want this code to be working for the whole workbook instead of worksheet.

    Could anyone help me with this code?
    Last edited by kawaitang; 01-28-2013 at 06:51 AM. Reason: solved.

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,428

    Re: Lock cell(s) after data input using macro.

    Maybe this will work for you:


    Please Login or Register  to view this content.

    Regards, TMS
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  3. #3
    Forum Guru Winon's Avatar
    Join Date
    02-20-2007
    Location
    East Rand, R.S.A.
    MS-Off Ver
    2010
    Posts
    6,113

    Re: Lock cell(s) after data input using macro.

    Hello kawaitang,

    Welcome to the Forum.

    What TMS gave you should do the job, or you could also try:

    Please Login or Register  to view this content.
    Please consider:

    Be polite. Thank those who have helped you. Then Click on the star icon in the lower left part of the contributor's post and add Reputation. Cleaning up when you're done. If you are satisfied with the help you have received, then Please do Mark your thread [SOLVED] .

  4. #4
    Registered User
    Join Date
    01-22-2013
    Location
    Utrecht, The Netherlands
    MS-Off Ver
    Excel 2010
    Posts
    14

    Re: Lock cell(s) after data input using macro.

    Thanks TMShucks and Winon! It works fantastic!

  5. #5
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,428

    Re: Lock cell(s) after data input using macro.

    You're welcome.

  6. #6
    Forum Guru Winon's Avatar
    Join Date
    02-20-2007
    Location
    East Rand, R.S.A.
    MS-Off Ver
    2010
    Posts
    6,113

    Re: Lock cell(s) after data input using macro.

    Glad we could help.

+ 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