schlacter901
New Member
- Joined
- Mar 2, 2016
- Messages
- 2
Hello everyone,
Been stuck on this for a while and thought you guys might be able to help out. I am writing a program and a snippet from fails to run. Basically i have a column of values and blanks that vary from -10 to +10. I wrote this code to flag values of interest. The selection for the conditional formatting includes a variable (this should not matter). The problem is that when my code gets to this snippet it breaks due to a Run-time error '1004'. I cannot for the life of me figure out why this is happening
Any help with this or ideas would be much appreciated.
Cheers!
Been stuck on this for a while and thought you guys might be able to help out. I am writing a program and a snippet from fails to run. Basically i have a column of values and blanks that vary from -10 to +10. I wrote this code to flag values of interest. The selection for the conditional formatting includes a variable (this should not matter). The problem is that when my code gets to this snippet it breaks due to a Run-time error '1004'. I cannot for the life of me figure out why this is happening
Code:
Sub conditionalboss()
Dim fire As Integer
'this is dynamic since it loops through multiple sheets of varying length
fire = 99
' for simplicity i defined it as 99 here this is done before in a different part of the code and it is
' initialized
Range("A1:A" & fire).Select
Dim cfIconSet As IconSetCondition
Set cfIconSet = Selection.FormatConditions.AddIconSetCondition
With cfIconSet
.ShowIconOnly = True
.IconSet = ActiveWorkbook.IconSets(xl3Symbols2)
End With
With cfIconSet.IconCriteria(1)
.Type = xlValueNumber ' This line will not run
.Value = 0 ' This line will not run
.Operator = xlGreater
End With
With cfIconSet.IconCriteria(2)
.Type = xlValueNumber
.Value = -1
.Operator = xlGreatedEqual
End With
With cfIconSet.IconCriteria(3)
.Type = xlValueNumber
.Value = -1
.Operator = xlLess ' This line will not run
End With
End Sub
Any help with this or ideas would be much appreciated.
Cheers!