Block certain cells in condition met in cell A

Clairexcel

New Member
Joined
Mar 23, 2021
Messages
31
Office Version
  1. 2016
  2. 2010
Hi there,
trying to figure out step by step how to build macros and learn more.
Now given that my other code was a mess, I figured I would simplify things. So let the formulas in the cells of my worksheet, but I would like a vba to perfrom the following:
1. My worksheet goes from A to T5000
2. If a user enters YES in cell A of a row, then I would like to block cells K, L, P, Q and T on that row, so that users can not enter anything in those cells.
3. Otherwise, if they they enter "no" in cell A, then the K, L, , Q should be unblocked in that row and they should be able to enter numbers. Cells P and T should always remain blocked though.
4. Also if cell A contains "no", I would like vba to automatically copy C to H range from the row above.
Is there any way I can record macros and then create a event macro with conditions if so then perform macro1, else perform marcro2"" ? How can I create such macros?
Do I have to create event? If so, can you please help me as in how to do it?
Thank you so very much.
 

Excel Facts

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).
And are there any values in cols E:H?
 
Upvote 0
Are there any merged cells?
@Fluff sorry for replying in delay yesterday night I was off wifi. No, there aren't any cell merged in this file. And After I opened it today the vba code still works but only in the first row where I input yes. It only blocks the cell K, L etc for the first yes, afterwards, in the other rows it doesn't...I am sure it is smth I did wrong, but I can not figure out what. Thank you for any further help you are willing to give me
 
Upvote 0
Yes, that was it... and maybe my file was having some issues on itself after so many changes and trials. Infact I created a new file, and it is working perfectly! Both locking corresponding cells in the row and copying C:H from row above if A contains no....
I can not THANK YOU enough. Thank you so very much indeed, I hope to be able to repay you with a code sooner or later!
 
Upvote 0

Forum statistics

Threads
1,214,826
Messages
6,121,795
Members
449,048
Latest member
greyangel23

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top