Results 1 to 2 of 2
  1. #1
    Join Date
    May 2014

    Unanswered: VBA/macro for conditional formatting a table that varies

    I am trying to create a VBA macro within Excel that will apply a 3 scale conditional formatting to 3 different ranges within a "table" in Excel, see attached. Each of the 3 ranges (separated by the blue lines which are actually cells) will be a separate conditional formatting rule. The totals will not be part of the conditional formatting, but what is the challenge is that the columns will vary. So another report may only have anywhere from 2 to the max of 10 columns, not including the totals. There will always be a column of "totals" and rows of totals and there will always be 3 different areas to color that will always begin at b10.

    How do I write the macro so that it chooses the first range of numbers (without coloring the totals or text)? The xldown, xlleft or xlright functions don't seem to work here.
    Attached Thumbnails Attached Thumbnails sample report snapshot.jpg  

  2. #2
    Join Date
    Apr 2014
    Provided Answers: 23
    do you mean like scan to find the TOTAL row?...
    Dim iTotCol As Long
    Range("B1").Select   'start
    While ActiveCell.Value <> ""
       ActiveCell.Offset(0, 1).Select  'next column
    iTotCol = ActiveCell.column

Posting Permissions

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