+ Reply to Thread
Results 1 to 3 of 3

Highlight Subtotals

Hybrid View

  1. #1
    Registered User
    Join Date
    12-16-2009
    Location
    Rome, NY
    MS-Off Ver
    Excel 2003
    Posts
    1

    Highlight Subtotals

    I have a macro that I created that sorts out information by groups. It combines twenty different spreadsheets, then sorts and groups the data. The data is different every day. I found a piece of code online that adds subtotals to those groups of data. It is very concise and works perfectly. I need to call attention to the subtotals if they are negative. If I use conditional formatting it highlights all negatives. There is so much data that I need to be able to pinpoint only the negative subtotals. Is there a way I can add something to the code to highlight the line if it is negative. Here is the attatched piece of code.

    For Each NumRange In Columns("L").SpecialCells(xlConstants, xlNumbers).Areas SumAddr = NumRange.Address(False, False) NumRange.Offset(NumRange.Count, 0).Resize(1, 1).Formula = "=SUM(" & SumAddr & ")" c = NumRange.Count 
    Next NumRange
    Last edited by teylyn; 12-16-2009 at 04:52 PM. Reason: added code tags

  2. #2
    Registered User
    Join Date
    03-25-2009
    Location
    Boston, MA
    MS-Off Ver
    Excel 2007
    Posts
    25

    Re: Highlight Subtotals

    Add the following to your internal loop.

      If numrange < 0 Then
        numrange.Fill.Color = RGB(255, 10, 0)
      End If
    You may have to tweak the RGB function to get the color you want.
    Last edited by teylyn; 12-16-2009 at 04:53 PM. Reason: added code tags

  3. #3
    Forum Expert teylyn's Avatar
    Join Date
    10-28-2008
    Location
    New Zealand
    MS-Off Ver
    Excel 365 Insider Fast
    Posts
    11,372

    Re: Highlight Subtotals

    Folks, please use code tags! I'll add them this once, but you'll need to do it yourselves thereafter ....

    Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code. Posting code without them makes your code hard to read and difficult to be copied for testing. Highlight your code and click the # at the top of your post window. For more information about these and other tags, found here

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1