Reputation: 3
I'd need to get an amount of hours from data in the following format:
'166:05 hod:min'
The first number is the amount of hours, next after ':'
are minutes. The rest can be thrown away.
My idea was to split the first number, add the second number divided by 60 [166:05 -> 166,08]
, but I'm the very beginner of VBA and these things.
Upvotes: 0
Views: 2631
Reputation: 7689
You can simply use the Split command in VBA,
Dim splitTarget() As Variant
Dim splitMin() as Variant
splitTarget = Split('166:05 hod:min', ":")
splitTarget(0)
should return 166 and splitTarget(1)
should return '05 hod'
splitMin = Split(splitTarget(0), " ")
SplitMin(0) will give you the 05
Upvotes: 1