Consulting

Results 1 to 8 of 8

Thread: how to Avoid zero in conditional formatting?

  1. #1

    how to Avoid zero in conditional formatting?

    hi i have following code to add cond.formating but in column there is "0" in cell
    so it formet that cell but i need to find small num. in column not the zero
    is there any way i can do that?
    thanks for looking my requestcl[VBA]
    .FormatConditions.Add Type:=xlExpression, Formula1:= _
    "=OR(RC=SMALL(R4C:R367C,1),RC=SMALL(R4C:R367C,2))" For Each cl In rng
    Select Case cl.Value
    Case Is = 0
    Case Is = ""
    Case Else
    With rng.FormatConditions(2)
    With .Font
    .Bold = True
    .ColorIndex = 5 '3
    End With
    '.Interior.ColorIndex = 39
    End With
    End Select
    Next
    [/VBA]

  2. #2
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    Untested

    [vba]

    "=AND(RC<>0,OR(RC=SMALL(R4C:R367C,1),RC=SMALL(R4C:R367C,2)))"
    [/vba]
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  3. #3
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    If you mean the 0 is in the list of numbers, try

    [vba]

    =OR(L1=SMALL(IF(L$4:L$367>0,L$4:L$367),{1,2}))
    [/vba]
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  4. #4
    hi xld
    thanks for that

    [VBA]"=AND(RC<>0,OR(RC=SMALL(R4C:R367C,1),RC=SMALL(R4C:R367C,2)))"[/VBA]
    but this work ,but it don't find the small num.

    and the next one give the error

    Run time error '5'
    " Invalid procedure call or argument"

    [VBA]"=OR(RC=SMALL(IF(R4C:R367C>0,R4C:R367C),{1,2}))" [/VBA]

    any insight in this is appreciated.

  5. #5
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    Can you post the workbook?
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  6. #6
    hi
    xld
    hear is the wb sample
    Attached Files Attached Files

  7. #7
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    Where is the code in here?
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  8. #8
    there is module in wb u can run for conditional formating

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •