VBA Macro Conditional Formatting

Closed
slohman Posts 3 Registration date Wednesday March 26, 2014 Status Member Last seen April 2, 2014 - Mar 26, 2014 at 01:39 AM
slohman Posts 3 Registration date Wednesday March 26, 2014 Status Member Last seen April 2, 2014 - Apr 2, 2014 at 01:00 AM
I need to find out how to write a macro that includes Conditional Formatting.

=if(and(Column A has the word "Dial")and(Column F has the word "Booked")and(Column J has a date in it I need the Columns from Row A:M to turn Blue.

I then have about 30 more conditions to add to the macro.

The macro can be set as a private or a command button or even on open or close of workbook

Any help on this would be great.

3 responses

venkat1926 Posts 1863 Registration date Sunday June 14, 2009 Status Contributor Last seen August 7, 2021 811
Mar 26, 2014 at 02:26 AM
try this macro
row 1 is header row



Option Compare Text
Sub test()

'assume row 1 is header row and no blank cells, blanks rows, blank columns
Dim r As Range, c As Range, j As Integer
Set r = Range(Range("A2"), Range("A2").End(xlDown))
For Each c In r
j = c.Row
If Cells(j, "A") = "Dial" And Cells(j, "F") = "Booked" Then
Range(Cells(j, "A"), Cells(j, "M")).Cells.Interior.ColorIndex = 5

End If
Next c


End Sub
0
slohman Posts 3 Registration date Wednesday March 26, 2014 Status Member Last seen April 2, 2014
Mar 26, 2014 at 03:36 AM
Thank you so much for that it works great for the first one but yes there is blanks in columns and rows and cells and the Dial Before You Dig appears down a number of times in column A and also Booked is found more than once in column f and the date appears in j many times. Can it look for the word Dial with a wildcard attached.
0
slohman Posts 3 Registration date Wednesday March 26, 2014 Status Member Last seen April 2, 2014
Apr 2, 2014 at 01:00 AM
Can anyone help with this??
0