Option
Explicit
Public
Enum
enmArt
Bezeichnung1
Milligramm
Bezeichnung2
Tablettenform
Bezeichnung3
End
Enum
Function
getDescription(
ByRef
rng
As
Excel.Range,
Optional
Art
As
enmArt)
As
String
Dim
o
As
Object
Select
Case
Art
Case
Is
= enmArt.Bezeichnung1
Case
Is
= enmArt.Milligramm
With
CreateObject(
"VBScript.RegExp"
)
.Pattern =
"[0-9]{1,4}mg"
If
(.Test(rng.Value)) =
True
Then
Set
o = .Execute(rng.Value)
getDescription = o(0).Value
End
With
Case
Is
= enmArt.Bezeichnung2
Case
Is
= enmArt.Tablettenform
Case
Is
= enmArt.Bezeichnung3
End
Select
End
Function