ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Conditional formating Run-time error '5' (https://www.excelbanter.com/excel-programming/435430-conditional-formating-run-time-error-5-a.html)

jonnybrovo815

Conditional formating Run-time error '5'
 
I have been using this code for quite some time now 1 year. All of a
sudden it stopped working and is giving me a "Run-time error '5' Invalid
procedure call or argument."

The code is was selecting a range of entered cells for column K starting at
row 9 and then selecting down to the last entered cell in that column. Can
anyone tell me why it is not working now when it was just a week ago?

It stops at the formula that is entered into the conditional formatting
formula 1.

Here is the code:

Sub DupsColK()
'
' DupsColK Macro
' '

'
Range("K9").Select
Range(Selection, Selection.End(xlDown)).Select
Selection.FormatConditions.Delete
Selection.FormatConditions.Add Type:=xlExpression, Formula1:= _
"=IF(COUNTIF($K:$K,$K9)1,COUNTIF($K$9:$K9,$K9)=1) "
Selection.FormatConditions(1).Interior.ColorIndex = 4
Selection.FormatConditions.Add Type:=xlExpression, Formula1:= _
"=IF(COUNTIF($K:$K,$K9)1,COUNTIF($K$9:$K9,$K9)1) "
Selection.FormatConditions(2).Interior.ColorIndex = 19
End Sub



All times are GMT +1. The time now is 03:06 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com