'************************************************************************************
' FONCTION FIND(LAST) ROW,COLUMN,CELL ON <<<defined range>>>
'Autor:patricktoulon
'version beta
'date version 29/03/2020
'************************************************************************************
Function UsedrangeOnRangeDef(tableau As Range) As Range
Dim lig&, col&, cel1 As Range, cel2 As Range
With tableau
Set cel1 = .Cells(1)
col = .Find("*", SearchOrder:=xlByColumns, SearchDirection:=xlPrevious).Column
lig = .Find("*", SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row
Set cel2 = Cells(lig, col)
Set UsedrangeOnRangeDef = .Parent.Range(cel1, cel2)
End With
End Function
'sub de test
Sub testusedRangedef()
Dim plage As Range
Set plage = [B:U]
MsgBox UsedrangeOnRangeDef(plage).Address
End Sub