+ Reply to Thread
Results 1 to 5 of 5

Simple Code Requirement

  1. #1
    Registered User
    Join Date
    04-23-2014
    Location
    Delhi
    MS-Off Ver
    Excel 2003
    Posts
    25

    Simple Code Requirement

    Hi Ciao,
    The following code you wrote is working, but I just have following two questions

    1- Can the code run automatically i.e. as the value of cell A1 is changed, the range D1:H1 should automatically get locked. Now I need to run the macro. So can this code be executed itself as soon as the value of cell A1 changes.

    2- Also can I just request for a slightly change in code. Instead on just one cell, can I have range i.e. A1 : A10 and this range can have any one of the four value (i.e. 1, 4, 7 & 8). So if the range A1:A10 has either 1 or 4 or 7 or 8, then the corresponding range from D : H should get locked.

    Please Login or Register  to view this content.
    For your convenience, I have put the code in the file and attached it whit this post. As I was not able to attach the file in previous post, I have started new post.

    Thanks a lot for your support.
    Nisha
    Attached Files Attached Files

  2. #2
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Simple Code Requirement

    Try this in your sheet1 code:

    Please Login or Register  to view this content.
    If I've helped you, please consider adding to my reputation - just click on the liitle star at the left.

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~(Pride has no aftertaste.)

    You can't do one thing. XLAdept

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~aka Orrin

  3. #3
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    12,613

    Re: Simple Code Requirement

    Nisha_NishaDelhi
    Your post does not comply with Rule 1 of our Forum RULES. Your post title should accurately and concisely describe your problem, not your anticipated solution.

    Use terms appropriate to a Google search. Poor thread titles, like Please Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will be addressed according to the OP's experience in the forum: If you have less than 10 posts, expect (and respond to) a request to change your thread title. If you have 10 or more posts, expect your post to be locked, so you can start a new thread with an appropriate title.

    To change a Title go to your first post, click EDIT then Go Advanced and change your title, if 2 days have passed ask a moderator to do it for you.

    (This thread should receive no further responses until this moderation request is fulfilled, as per Forum Rule 7)
    Ben Van Johnson

  4. #4
    Registered User
    Join Date
    04-23-2014
    Location
    Delhi
    MS-Off Ver
    Excel 2003
    Posts
    25

    Re: Simple Code Requirement

    Hi Xladept,

    Thanks for your help. The code is working. But there is a small issue.

    As I mentioned that Col A can only have 1, 4, 7, 8 as value. Now if I put 1 in A1 the range from D1:H1 gets locked. This is correct.

    But if I change the value to any other (except for 1,4,7,8) the range from D:H still remain lock. So if I change the value of A1 from 1 to 2 , the range from D1:H1 is still locked.

    Thanks,
    Nisha

  5. #5
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    12,613

    Re: Simple Code Requirement

    Your post does not comply with Rule 7 of our Forum RULES. Please do not ignore requests by Administrators, Moderators and senior forum members regarding forum rules.

    If you are unclear about the request or instruction then send a private message to them asking for clarification.

    All participants:
    Please do not post a reply in a thread where a moderator has requested an action that has not yet been complied with e.g Title change or Code tags...etc. Thanks.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Cell Locking based on If condition
    By Nisha_NishaDelhi in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-24-2014, 12:02 PM
  2. Code Requirement
    By Alokshah7 in forum Excel General
    Replies: 1
    Last Post: 06-28-2013, 03:09 PM
  3. Replies: 1
    Last Post: 05-24-2013, 06:02 AM
  4. Need vba code for downloading Requirement mapping from Quality Center
    By kiran527 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 12-30-2012, 10:30 PM
  5. help on this simple code... or not so simple?
    By bondcrash in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 03-18-2005, 07:25 AM

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