Results 1 to 2 of 2
  1. #1
    New Lounger
    Join Date
    Oct 2015
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Having troubles with conditional formatting formula

    Hello everyone! Hoping someone can help a newbie out:



    Code:
    Set allProducts = Range(Range("ProdStart").Offset(1, 0), Range("ProdStart").End(xlDown).End(xlToRight))
    allProducts.FormatConditions.Add Type:=xlExpression, Formula1:="=$a14=""" & prodName & """"
    allProducts.FormatConditions(allProducts.FormatConditions.count).Interior.Color = SColor
    So what i am trying to do is checking the first cell in each row of a table (allProducts) to see if it matches prodName. If it does, i set that row equal to a specified color.


    This code i have now works out, but ONLY when my active/selected cell on my spreadsheet is on row 14. I'm not sure what im doing wrong!

  2. #2
    WS Lounge VIP rory's Avatar
    Join Date
    Dec 2000
    Location
    Burwash, East Sussex, United Kingdom
    Posts
    6,280
    Thanks
    3
    Thanked 191 Times in 177 Posts
    Nothing - it's a bug. If you use relative addressing in the formula you have to have the active cell in the correct row/column just as if you were doing it manually.
    Regards,
    Rory

    Microsoft MVP - Excel

Posting Permissions

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