Consulting

Results 1 to 4 of 4

Thread: a certain type of formula

  1. #1
    VBAX Mentor
    Joined
    Jun 2005
    Posts
    374
    Location

    a certain type of formula

    hello
    is it possible to select or color a certain type of formulas within a range.
    can i select all cells in a range containing a sum formula or just the cells containing average formula.
    thanks
    moshe

  2. #2
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    Not without a ton of work I think.

  3. #3
    Wasn't THAT much work!

    [VBA]Sub Test()
    Dim c As Range
    For Each c In Selection
    If UCase(Mid(c.Formula, 1, 4)) = "=SUM" Then
    With c.Interior
    .ColorIndex = 36
    .Pattern = xlSolid
    .PatternColorIndex = xlAutomatic
    End With
    End If
    Next c
    End Sub[/VBA]

  4. #4
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    That is because you are being too simplistic.

    What about

    =IF(A1=17,VLOOKUP(A1,M1:N20,2,FALSE),SUM(A1:A20))

    that's a SUM formula in my book, and I can think of loads far mor complex than that. And if you just check for SUM rather than =SUMm, how about

    =IF(A1=10,"SUMMARY DATA","")

    and we haven't even started on the other functions yet.

Posting Permissions

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