Hi all,
I have a VBA script which is designed to conditional format certain cells based on another cells dropdown selection however every time i run it i get the runtime 13 error. Now i know the formula is a big one within this macro however i've been told this is the only way I can get excel to conditionally format using this formula. Can someone help?
I am using excel 2003 if that helps anyone. Thanks
I have a VBA script which is designed to conditional format certain cells based on another cells dropdown selection however every time i run it i get the runtime 13 error. Now i know the formula is a big one within this macro however i've been told this is the only way I can get excel to conditionally format using this formula. Can someone help?
I am using excel 2003 if that helps anyone. Thanks
Code:
Sub format()
'
' format Macro
' Macro recorded 30/07/2013 by James Pite
'
' Keyboard Shortcut: Ctrl+e
'
Range("D14:AZ20").Select
Selection.FormatConditions.Delete
Selection.FormatConditions.Add Type:=xlExpression, Formula1:="=AND(D$4>=VALUE(LEFT(INDEX($D$57:$AA$63,MATCH($C6,$C$57:$C$63,0),MATCH($A$13,$D$56:$AA$56,0)),FIND(" - ",INDEX($D$57:$AA$63,MATCH($C6,$C$57:$C$63,0),MATCH($A$13,$D$56:$AA$56,0)))-1)),D$4<=VALUE(MID(INDEX($D$57:$AA$63,MATCH($C6,$C$57:$C$63,0),MATCH($A$13,$D$56:$AA$56,0)),FIND(" - ",INDEX($D$57:$AA$63,MATCH($C6,$C$57:$C$63,0),MATCH($A$13,$D$56:$AA$56,0)))+1,255)))"
With Selection.FormatConditions(1).Font
.Bold = False
.Italic = False
.ColorIndex = 1
End With
Selection.FormatConditions(1).Interior.Pattern = xlNone
End Sub