Hi, I wonder whether someone may be able to help me please.

I'm using the code below to perform the following:
  • For each value change in column B (Staff Name)
  • Insert a subtotal row and add the value from column B and the text "FTE Subtotal", to column G and
  • For each subtotal row, sum the values from columns H and expand for 12 columns

Sub Subtotals(ws As Worksheet)
    
    Dim cll As Range
    Dim LastRow As Long
    Dim lngCounter As Long
    Dim lngStart As Long
    
    Application.ScreenUpdating = False
    Const StartRow As Long = 8
    
    With ws
        '****Column B contains the Staff Name across mutliple rows
        lngStart = .Range("B" & .Rows.Count).End(xlUp).Row
        For lngCounter = lngStart To 8 Step -1
            '****For each change in Staff Name
            If .Cells(lngCounter, "B").Value <> .Cells(lngCounter - 1, "B").Value Then
                .Rows(lngStart + 1).Insert
                '****The line below adds the value from column B + the word "FTE Subtotal"
                With .Cells(lngStart + 1, "G")
                    .Value = ws.Cells(lngCounter, "B").Value & " FTE Subtotal"
                    .HorizontalAlignment = xlRight
                    With .Interior
                        .Pattern = xlSolid
                        .PatternColorIndex = xlAutomatic
                        .Color = 8388608
                    End With
                    With .Font
                        .Name = "Lucida Sans"
                        .Bold = True
                        .Size = 10
                        .ColorIndex = 2
                    End With
                    
                    '****For each change in the Staff Name sum the values in column H and expand for 12 columns
                    With .Offset(0, 1)
                        .Formula = "=SUM(H" & lngCounter & ":H" & lngStart & " )"
                        .NumberFormat = "0%"
                        With .Interior
                            .Pattern = xlSolid
                            .PatternColorIndex = xlAutomatic
                            .Color = 16764057
                        End With
                        With .Font
                            .Name = "Lucida Sans"
                            .Bold = True
                            .Size = 10
                        End With
                        .AutoFill Destination:=.Resize(1, 12), Type:=xlFillDefault
                    End With
                    lngStart = lngCounter - 1
                End With
            End If
            Next lngCounter
        End With
    End Sub
This code works fine, but what I'm now trying to do is insert another row directly beneath that for the subtotal which again uses the value from column B , but instead of the text "FTE Subtotal", insert the text "Remaining".

I thought I'd cracked this, but after working on this for the last few days, sadly I'd haven't been able to resolve the problems I have.

I appreciate it may be easier for me to post a workbook, but at the moment, unfortunately I'm unable to do so.

But, I just wondered whether someone may be able to look at this and offer some guidance on how I may go about achieving this.

Many thanks and kind regards

Chris