Excel cell conditional Formatting using VBA

Nikhil2803

New Member
Joined
Jul 18, 2023
Messages
36
Office Version
  1. 365
Platform
  1. Windows
I have a cell in excel sheet that contains data that should be in date format. I need to give the conditions as : "A Date of Birth that is under 16, over 100 or after the Date of Hire" should be an invalid. Please help my how to achieve this using VBA in excel.
 

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.
What columns are Date of Birth and Date of Hire in?

Also, I am a little unclear as to what method you want to use, as:
- Conditional Formatting can only format cells (i.e. change color, font, etc). It cannot prevent entries, only highlight them.
- Data Validation can be used to prevent entries and pop-up error methods. See this link here: Custom Data Validation in Excel : formulas and rules
- VBA can be used to to do all of that (prevent entries, pop-up error messages, format cells, etc)

So how exactly do you want this to work? Do you actually want to prevent the values from being entered, pop-up error messages, or just format the offending cells?
 
Upvote 0

Forum statistics

Threads
1,216,085
Messages
6,128,733
Members
449,465
Latest member
TAKLAM

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