denon101 Posted December 1, 2008 Posted December 1, 2008 Hi, I am looking to write a formula to highlight childrens birthdays. Ie all of the children who have a birthday in Jan, Feb, Mar etc!! The dates are in DD/MM/YYYY format. I have spent some time looking around google and as yet have not come up with the answer. Any suggestions would be appreciated!!
JOrdan01070 Posted December 1, 2008 Posted December 1, 2008 (edited) you could use the code below do to conditional formating Option Explicit Private Sub Worksheet_Change(ByVal Target As Range) Dim weekday As String Dim vColor As Integer Dim cell As Range For Each cell In Target weekday = cell.Value vColor = 0 'default is no color Select Case Format(weekday, "mmm") Case "Jan" vColor = 34 Case "Feb" vColor = 36 End Select Application.EnableEvents = False cell.Interior.ColorIndex = vColor Application.EnableEvents = True Next cell End Sub hope this helps Edited December 1, 2008 by JOrdan01070 code change
laserblazer Posted December 1, 2008 Posted December 1, 2008 Conditional Format is the way to go but if you are looking for something quick, highlight the relevant column, use Conditional Format to format the first range, then click on ADD do the next range and so on. It's not an elegant solution but it should work, assuming you can build up enough conditions. I don't know what the limit is.
JOrdan01070 Posted December 1, 2008 Posted December 1, 2008 Conditional Format is the way to go but if you are looking for something quick, highlight the relevant column, use Conditional Format to format the first range, then click on ADD do the next range and so on. It's not an elegant solution but it should work, assuming you can build up enough conditions. I don't know what the limit is. I think you can only have three conditional formats, but with the code you can have as many as you need.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now