I have never used VBA or macros before
Is there a way I Can lock a cell after say a date
so I want to lock cells in Column H once the date in C1 is past the date in the corresponding cell in Column B. ie. H25 and B25
I have never used VBA or macros before
Is there a way I Can lock a cell after say a date
so I want to lock cells in Column H once the date in C1 is past the date in the corresponding cell in Column B. ie. H25 and B25
Last edited by wildecoyote1966; 01-02-2022 at 07:54 PM. Reason: correcting details
Are you sure it is the right file (or the right explanation in the post)?
Columns you mention in text seem to be different than in a file.
Best Regards,
Kaper
I am not sure if you want the cells in Column H blocked before mentioned date or after, so in this code I assumed "Before":
Please paste below macro in the code module of the worksheet ( to open by RightClick on the worksheet tab "Amort", and then click on "View Code" )
CheersPlease Login or Register to view this content.
Erwin
I started learning VBA because I was lazy ...
Still developing.... being more lazy...
Ok, so you need to change the range-statement line into these two:
CheersPlease Login or Register to view this content.
Erwin
Hi Erwin
like this?
Please Login or Register to view this content.
doesn't seem to have changed anything (probably me)
Last edited by AliGW; 01-03-2022 at 06:09 AM. Reason: Code tags added.
Yes,
the code in this way unlocks all the cells before/above found date, and locks all cells below/after found date. (in the first code it was just the opposite)
But maybe you need first to unlock all your cells in column H first before trying, and please keep the rules of this forum by embedding you code into code-tags (it's the "hashtag" mark in the editing options above your writing.)
Cheers
Erwin
Hi Erwin
I don't see the option to post code as you said. Maybe I'm to new.
Basically once the date in C1 passes the date in column B passes I want to lock the corresponding cell in Column H and the ones above it.
Can't change the past only the future
Well, for me this works, please see attachment
Cheers
Erwin
The merit part is handled by Eastw00d, so let me just show (screenshot attached) how to wrap CODE tags around the code to obtain such a result:
Please Login or Register to view this content.
Thanks Erwin
I however need the opposite please
Sorry but I don't understand how this works. Itried changing true to false and false to true but nothing seems to change
Administrative Note:
Welcome to the forum.
We would very much like to help you with your query, however you need to include code tags around your code.
Please take a moment to add the tags. Posting code between [code]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/code] tags makes your code much easier to read and copy for testing, and it also maintains VBA formatting.
Please see Forum Rule #2 about code tags and adjust accordingly. Click on Edit to open your post, then highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found here
(Note: this change is not optional. As you are quite new here, I have done it for you this time.)
Ali
Enthusiastic self-taught user of MS Excel who's always learning!
Don't forget to say "thank you" in your thread to anyone who has offered you help.
You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.
Forum Rules (updated August 2023): please read them here.
yes Ali Kaper just showed me how. Thank you for doing it for me this time
Blocked everything from H38 downPlease Login or Register to view this content.
and
made no difference to the first changePlease Login or Register to view this content.
then I
removed NOT from If Not Intersect(Target, [c1]) Is Nothing ThenPlease Login or Register to view this content.
and I think it's working.
Last edited by wildecoyote1966; 01-03-2022 at 08:46 PM. Reason: adding additional information
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks