Conditional formatting thick borders around cells based on Value in C column

In a workbook for a production company, they would like to track in which department their products are located.

What the workbook looks like.
enter image description here

I am trying to auto format thick borders around a cell range based on the "Type" located in column C.
To illustrate, the range selected C2-4:AC2-4 needs to be formatted with thick outside borders since they are from the same Type "Potato".
Next the type "Pineapple" should be formatted in the same way, C5-C8:AC5-AC8 should be the selected range and formatted to thick borders. And so forth.

Additional departments could be added later, which is why it would be great if the macro could find the range of columns from C to last filled cell column.

The Type column is filled based on a data sheet that is built from a query and auto updates when new products are added into the ERP system, this means that the size of the type column changes when new products are added or removed.

What it should look like after the macro.
example 2

I am using Gserg's suggestion with double conditional formatting. I would still like to use VBA to format thick borders, perhaps only bottom thick should be fine using the rule stated by Gserg.

I tried puzzling some stuff together in VBA and have the following, haven't managed to get it to work.

Sub format()
 
Dim srg As Range: Set srg = Range("A1").CurrentRegion
Dim irg As Range: Set irg = srg.Resize(srg.Rows.Count - 1, srg.Columns.Count - 2).Offset(1, 2)

irg.Select
With Selection
    .FormatConditions.Add Type:=xlExpression, Formula1:="=AND(NOT(ISBLANK($C2)); $C2<>OFFSET($C2;-1;0); $C2=OFFSET($C2;1;0))"
    With .FormatConditions(.FormatConditions.Count)
        .SetFirstPriority
        With .FormatConditions(1)
            .Borders (xlEdgeBottom)
            .LineStyle = xlContinuous
            .Weight = xlThick
            .Color = 0
            .TintAndShade = 0
        End With
    End With
End With

End sub

It returns

run time error 438 "Object doesn't support this property or method"


Solution 1:

Create two conditional formatting rules for the entire table.

=AND(NOT(ISBLANK($C2)), $C2<>OFFSET($C2,-1,0), $C2=OFFSET($C2,1,0))
=AND(NOT(ISBLANK($C2)), $C2<>OFFSET($C2,1,0), $C2=OFFSET($C2,-1,0))

The first will paint the first row of the group, the second will paint the last row. Format them accordingly with top and bottom thick borders. Apply a top-down and down-up shadow gradient respectively for a stylistic touch, which may save you introducing the third rule for drawing the side borders for middle rows.