Function decrown_dia(Rng,Optional front AsBoolean=True)If TypeName(Rng)="String"Then
decrown_dia = Rng
ElseIf TypeName(Rng)="Range"Then
decrown_dia = Rng.Value
Else
decrown_dia = CVErr(xlErrValue)GoTo fail
EndIfIf InStr(1, decrown_dia, "×")>0ThenIf front Then
decrown_dia =Val(Mid(decrown_dia,1, InStr(1, decrown_dia, "×")-1))Else
decrown_dia =Val(Mid(decrown_dia, InStr(1, decrown_dia, "×")+1))EndIfElseIf InStr(1, decrown_dia,"*")>0ThenIf front Then
decrown_dia =Val(Mid(decrown_dia,1, InStr(1, decrown_dia,"*")-1))Else
decrown_dia =Val(Mid(decrown_dia, InStr(1, decrown_dia,"*")+1))EndIfElse
decrown_dia = CVErr(xlErrName)EndIf
fail:EndFunctionFunction DBH_dia(Rng,Optional main AsBoolean=True)If TypeName(Rng)="String"Then
DBH_dia = Rng
ElseIf TypeName(Rng)="Range"Then
DBH_dia = Rng.Value
Else
DBH_dia = CVErr(xlErrValue)GoTo fail
EndIfIf InStr(1, DBH_dia,"+")>0ThenIf main Then
DBH_dia =Val(Mid(DBH_dia,1, InStr(1, DBH_dia,"+")-1))Else
DBH_dia =Mid(DBH_dia, InStr(1, DBH_dia,"+")+1)EndIfElseIf InStr(1, DBH_dia,",")>0ThenIf main Then
DBH_dia =Val(Mid(DBH_dia,1, InStr(1, DBH_dia,",")-1))Else
DBH_dia =Mid(DBH_dia, InStr(1, DBH_dia,",")+1)EndIfElseIf InStr(1, DBH_dia,"*")>0ThenIf main Then
DBH_dia =Val(Mid(DBH_dia,1, InStr(1, DBH_dia,"*")-1))Else
main_str =Mid(DBH_dia,1, InStr(1, DBH_dia,"*")-1)
times =Val(Mid(DBH_dia, InStr(1, DBH_dia,"*")+1))-2
res = main_str
For i =1To times
res = res +"+"+ main_str
Next i
DBH_dia = res
EndIfElseIf InStr(1, DBH_dia, "×")>0ThenIf main Then
DBH_dia =Val(Mid(DBH_dia,1, InStr(1, DBH_dia, "×")-1))Else
main_str =Mid(DBH_dia,1, InStr(1, DBH_dia, "×")-1)
times =Val(Mid(DBH_dia, InStr(1, DBH_dia, "×")+1))-2
res = main_str
For i =1To times
res = res +"+"+ main_str
Next i
DBH_dia = res
EndIfElse
DBH_dia =""EndIf
fail:EndFunction