Data Validation to VBA

Src016

New Member
Joined
May 21, 2019
Messages
10
Hi All!

I need to translate the following data validation rules to VBA:

Rule 1:
Cell does not contain: no blanks format - as white
-- stop as true

Rule 2:
=OR($J3="Pending - Please Elaborate in Notes")

as red


Both of these formatting rules apply to $K2 through $K1048576

I am generating templates and need this conditional to run within a sub that runs as soon as you open the workbook.

This would be a huge help!
Thanks
Spence
 

Excel Facts

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.
What you are describing is conditional formatting, not data validation.

Do you want VBA create these rules and add them to the sheet? Why not just put the rules right into the template, rather than running VBA to create them? Not clear on why you are looking to do this in VBA.
 
Last edited:
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,177
Members
453,021
Latest member
Justyna P

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