## USStandardToMetric

Converts US Standard Measure into a Metric Measure.
Arguments:
Standardmeasure > The US Standard measure to convert (This must be a number only)
Conversion > Use table below for values:
in-cm = inches to centimeters
ft-cm = feet to centimeters
in-m  = inches to meters
yd-m = yards to meters
mi-km = miles to kilometers
oz-g  = ounces to grams
lbs-g = pounds to grams
oz-kg = ounces to kilogram
lbs-kg = pounds to kilograms
pt-l  = pints to liters
qt-l  = quarts to liters
gal-l  = gallons to liters
Extensiontype > integer that specifies the type of extension to append to the converted value:
0 = no extension (answer will be a number only)
1 = append the standard abbreviation (g for grams, kg for kilograms, etc...)
2 = append the full unit word (grams, kilograms, etc...)

Function USStandardToMetric(byVal StandardMeasure, byVal Conversion, byVal ExtensionType)
Dim tmp, multiplier, extension, ext
Select Case UCase( Conversion )
Case "IN-CM" : multiplier = 2.54  : extension = "centimeters" : ext = "cm"
Case "FT-CM" : multiplier = 30.48 : extension = "centimeters" : ext = "cm"
Case "IN-M"  : multiplier = 0.00254 : extension = "meters"   : ext = "m"
Case "YD-M"  : multiplier = 0.914 : extension = "meters"   : ext = "m"
Case "MI-KM" : multiplier = 1.609 : extension = "kilometers" : ext = "km"
Case "OZ-G"  : multiplier = 28.35 : extension = "grams"   : ext = "g"
Case "LBS-G" : multiplier = 453.59 : extension = "grams"   : ext = "g"
Case "OZ-KG" : multiplier = 0.028 : extension = "kilograms"  : ext = "kg"
Case "LBS-KG" : multiplier = 0.454 : extension = "kilograms"  : ext = "kg"
Case "PT-L"  : multiplier = 0.473 : extension = "liters"   : ext = "L"
Case "QT-L"  : multiplier = 0.946 : extension = "liters"   : ext = "L"
Case "GAL-L" : multiplier = 3.785 : extension = "liters"   : ext = "L"
End Select
tmp = Formatnumber(multiplier * StandardMeasure, 2)
Select Case CInt(ExtensionType)
Case 0   : tmp = Trim( tmp )
Case 1   : tmp = tmp & " " & ext
Case 2   : tmp = tmp & " " & extension
Case Else   : tmp = Trim( tmp )
End Select
USStandardToMetric = tmp
End Function
standardmeasure, conversion, extensiontype.