Consulting

Results 1 to 4 of 4

Thread: Formating Subtotals

  1. #1

    Formating Subtotals

    Hi,

    I recorded the code below with aim of formating occupied subtotal cells. However, the format is applied to all the empty cells below the final grand total row. How can I restrict the format to the range I want?

    Thanks.

    [vba]Selection.Subtotal GroupBy:=2, Function:=xlSum, TotalList:=Array(9, 13), _
    Replace:=True, PageBreaks:=False, SummaryBelowData:=True
    ActiveSheet.Outline.ShowLevels RowLevels:=2
    Range("I:I,M:M").SpecialCells(xlCellTypeVisible, xlNumbers).Interior.ColorIndex = 15
    Range("I:I,M:M").SpecialCells(xlCellTypeVisible, xlNumbers).Font.Bold = True[/vba]

  2. #2
    Moderator VBAX Wizard lucas's Avatar
    Joined
    Jun 2004
    Location
    Tulsa, Oklahoma
    Posts
    7,323
    Location
    You use selection so what area did you select before running this?
    Steve
    "Nearly all men can stand adversity, but if you want to test a man's character, give him power."
    -Abraham Lincoln

  3. #3
    That was part of the recorded subtotal process. You have to select at least one cell, and it then selects the entire range automatically.

  4. #4
    Moderator VBAX Wizard lucas's Avatar
    Joined
    Jun 2004
    Location
    Tulsa, Oklahoma
    Posts
    7,323
    Location
    starsky, could you possibly post your workbook.

    click on go advanced and scroll down and look for a button that says manage attachments.
    Steve
    "Nearly all men can stand adversity, but if you want to test a man's character, give him power."
    -Abraham Lincoln

Posting Permissions

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