Macro: Autopopulate Cells based on input in one cell

decksie

New Member
Joined
Apr 1, 2016
Messages
16
I need help with a macro. I've found lots of macros online that a described to do almost what I want but my VB grasp is never enough to modify it to my needs. I've bought a VBA book to teach mycself but I'm afraid I need this spreadsheet too soon to wait for me to upskill.

I'm creating a date entry spreadsheet that needs to accept data that I manually input from completed questionnaires. In short


In cell A2, I will enter a value 'Yes' or 'No'. I've made a drop down box through data validation.
If I enter 'No', I want to autopopulate cells A3:A9 and A12:A18 with "N/A"
If I enter 'Yes' I want those aforementioned cells to remain blank so that I can manually populate them.
I'd like this code to work equally for each column with the corresponding rows affected.

As a bit of bonus functionality, if it isn't difficult, If I accidentally enter 'No' in cell E2 and it autopopulates E3:E9 and E12:E18, if I change it back to 'Yes', can it cleat those N/As that shouldn't be there?

Thanks,
DD
 
Glad I was able to help you.
Come back here to Mr. Excel next time you need additional assistance.
Thank you both

As 'My answer is this' says, the longer code is great for a learner like me who has a better chance of understanding the syntax and logic, making minor adjustments relatively easy if necessary. But of course, I hope to get to the level one day where one line of succinct code such as Rick proposed is all I need to solve these problems!

Cheers,
Dan
 
Upvote 0

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.

Forum statistics

Threads
1,223,705
Messages
6,173,996
Members
452,542
Latest member
Bricklin

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