Public Function TrimRange( _
rngSource As Range, _
Optional TrimTop As Integer = 0, _
Optional TrimBottom As Integer = 0, _
Optional TrimLeft As Integer = 0, _
Optional TrimRight As Integer = 0 _
) As Range
Set TrimRange = _
rngSource.Offset( _
rowoffset:=TrimTop, _
columnoffset:=TrimLeft _
).Resize( _
rngSource.Rows.Count - TrimTop - TrimBottom, _
rngSource.Columns.Count - TrimLeft - TrimRight _
)
End Function

Leave a Reply