+ Reply to Thread
Results 1 to 2 of 2

How do you use a macro to format subtotal rows?

Hybrid View

  1. #1
    Registered User
    Join Date
    10-03-2007
    Posts
    16

    How do you use a macro to format subtotal rows?

    Is it possible to select all the subtotal rows and columns using a macro.. for example the code below is in the macro to show the excel sheet only from level 2 or only the subtotals.

        ActiveSheet.Outline.ShowLevels RowLevels:=2
    Is there a way to select RowLevel 2 cells and format? Any help would be awesome!

  2. #2
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    Hi,

    I record this. See if it helps

    Non VBA way

    http://www.exceltip.com/st/Applying_...Excel/270.html

        Range("A1").CurrentRegion.Select
        With ActiveSheet.Outline
            .AutomaticStyles = False
            .SummaryRow = xlBelow
            .SummaryColumn = xlRight
        End With
        Selection.ApplyOutlineStyles
        With ActiveWorkbook.Styles("RowLevel_2")
            .IncludeNumber = False
            .IncludeFont = True
            .IncludeAlignment = False
            .IncludeBorder = False
            .IncludePatterns = True
            .IncludeProtection = False
        End With
        With ActiveWorkbook.Styles("RowLevel_2").Interior
            .ColorIndex = 36
            .PatternColorIndex = xlAutomatic
            .Pattern = xlSolid
        End With
    VBA Noob
    _________________________________________


    Credo Elvem ipsum etian vivere
    _________________________________________
    A message for cross posters

    Please remember to wrap code.

    Forum Rules

    Please add to your signature if you found this link helpful. Excel links !!!

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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