locking and inserting formula in the cell based on value of another cell

alirazafazal

New Member
Joined
Jun 24, 2012
Messages
2
I am having an issue on Excel. I have a drop down menu in cell D5, with three options, A, B, and C.
If A is to be selected, cell content in D6 should become zero/clear-out [i.e., available for manual input by user], and cells D7, D8 and D9 should be locked while having formulas assigned to them as follows: for D7, =D6*G9, for D8 = D6*G10, for D9 = D6*G11
Similarly, if B is to be selected, cell content in D7 should become zero or clear-out, and cells D6, D8 and D9 should be locked while having the following formulas assigned to them for D6 = D7*G8, for D8 = D6*G10, for D9 = D6*G11
And lastly, if C is to be selected, cell content in D8 and D9 to be zeroed out and available for user input, while cells D6 and D7 are locked out and have following formula assigned to them: D6=(D8+D9)*I9, D7= D6*G9
I am completely novice on VBA in Excel and clueless as to how to solve this issue.
I got a code by googling which helps me to lock out cells, but I have no idea how to blank out cells and assign formulas.
The issue is, if I just type in the formula, lets say in D6, and user selects option A in dropdown, he will have option to overwrite value in D6 and later on if option B or C is chosen, D6 will remain static instead of moving in line with the values input in D7-D9 when options B/C are chosen.
Can someone please help
 

Excel Facts

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.
Hey alirazafazal,

Yes you are definitely looking at VBA here. Unfortunately it is beyond my knowledge. I am sure one of the other members is experienced enough though as I continue to learn new things from them.

Have you thought of a different approach where as if they enter a certain thing then it takes them to a different worksheet in the workbook which would have the appropriate cells already locked?

As you did not provide a visual example of the before and after I can only guess at possible solutions.
I am not sure if it is possible to lock cells as in most cases it is like a three step process to do so including selecting the cells you want to be unlocked, locking the other cells, entering a password, but I am sure that someone would know as all it should be is the macro bypassing the human interface a bit.

Hey VBA experts: Is this possible?

later

Ty
 
Upvote 0

Forum statistics

Threads
1,215,727
Messages
6,126,508
Members
449,316
Latest member
sravya

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